Any idea on how can I solve this issue?
I really need to install pyfftw into a conda environment, which already has the other libraries I need, such as tensorflow. Up until know, I could only install the other libraries correctly (namely tensorflow) for python 3.9.
I'm working on a Mac M1.
Here is the error output for the command pip install pyfftw:
Collecting pyfftw
Using cached pyFFTW-0.12.0.tar.gz (137 kB)
Requirement already satisfied: numpy<2.0,>=1.10 in /Users/mymac/miniforge3/envs/tf/lib/python3.9/site-packages (from pyfftw) (1.19.5)
Building wheels for collected packages: pyfftw
Building wheel for pyfftw (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/mymac/miniforge3/envs/tf/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"'; __file__='"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-wheel-6urq200p
cwd: /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-3.9
creating build/lib.macosx-11.0-arm64-3.9/pyfftw
copying pyfftw/config.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw
copying pyfftw/_version.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw
copying pyfftw/__init__.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw
creating build/lib.macosx-11.0-arm64-3.9/pyfftw/builders
copying pyfftw/builders/builders.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/builders
copying pyfftw/builders/__init__.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/builders
copying pyfftw/builders/_utils.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/builders
creating build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/cache.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/__init__.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/scipy_fft.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/dask_fft.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/numpy_fft.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/scipy_fftpack.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
copying pyfftw/interfaces/_utils.py -> build/lib.macosx-11.0-arm64-3.9/pyfftw/interfaces
UPDATING build/lib.macosx-11.0-arm64-3.9/pyfftw/_version.py
set build/lib.macosx-11.0-arm64-3.9/pyfftw/_version.py to '0.12.0'
running build_ext
error: Could not find the FFTW header 'fftw3.h'
----------------------------------------
ERROR: Failed building wheel for pyfftw
Running setup.py clean for pyfftw
Failed to build pyfftw
Installing collected packages: pyfftw
Running setup.py install for pyfftw ... error
ERROR: Command errored out with exit status 1:
command: /Users/mymac/miniforge3/envs/tf/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"'; __file__='"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-record-qt54h1vj/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mymac/miniforge3/envs/tf/include/python3.9/pyfftw
cwd: /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/
Complete output (7 lines):
running install
running build
running build_py
UPDATING build/lib.macosx-11.0-arm64-3.9/pyfftw/_version.py
set build/lib.macosx-11.0-arm64-3.9/pyfftw/_version.py to '0.12.0'
running build_ext
error: Could not find the FFTW header 'fftw3.h'
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/mymac/miniforge3/envs/tf/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"'; __file__='"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-5kpcegg9/pyfftw_56df32e267e3416fb4e9f01e6282e505/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-record-qt54h1vj/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mymac/miniforge3/envs/tf/include/python3.9/pyfftw Check the logs for full command output.
The PyPA doesn't host a precompiled wheel for osx-arm64, so it is building from source. According to the documentation, when source building, one is required to have FFTW installed first. Fortunately, Conda Forge appears to be building this (including osx-arm64), so try
conda install -c conda-forge fftw
pip install pyfftw
Otherwise, I dropped an issue to the Conda Forge feedstock, noting that they should be capable of building an osx-arm64 build. Hopefully that will move forward and in the future one could avoid Pip and local compilation altogether.
UPDATE: the feedstock is now building for osx-arm64, so you should be able to use
conda install -c conda-forge pyfftw
Related
Although there's no official support for Detectron2 on Windows, there're many instructions available. I tried following these instruction, but ended up with the same error.
Here's my setup:
OS: Windows 10 Pro 19043.1466
Microsoft Visual Studio: 2019
CUDA: 11.3
Here's the installation algorithm I'm trying to follow (taken from https://stackoverflow.com/a/70498119/1897063)
Set up environment variables for Microsoft Visual Studio by running vcvars64.bat:
C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat
Add new system path for cl.exe in my PATH variable:
C:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64
Open Anaconda Promt with administrator privileges
Create new Conda environment with Python 3.7:
conda create -n detectron_env python=3.7
Activate newly created environment detectron_env:
conda activate detectron_env
Install cudatoolkit for CUDA 11.3
conda install –c anaconda cudatoolkit=11.3
Install cudnn
conda install -c anaconda cudnn
Install pywin32
conda install -c anaconda pywin32
Install pytorch, torchvision and torchaudio for CUDA 11.3
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c
pytorch
Check whether GPU is enabled for Pytorch:
python -c "import torch; print(torch.cuda.is_available())"
Install additional packages
conda install -c anaconda cython
pip install opencv-python
pip install git+https://github.com/facebookresearch/fvcore
pip install
git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install av
conda install -c anaconda scipy
conda install -c anaconda ninja
Go to the directory where I want to install detectron2
e:
cd e:/TRON
Git clone detectron2 repository
git clone https://github.com/facebookresearch/detectron2.git
detectron_repo
Install dependencies
pip install -q -e detectron_repo
And everything breaks here:
(detectron_env) e:\TRON>pip install -q -e detectron_repo
ERROR: Command errored out with exit status 1:
command: 'C:\Users\E-soft\Anaconda3\envs\detectron_env\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:\\TRON\\detectron_repo\\setup.py'"'"'; __file__='"'"'E:\\TRON\\detectron_repo\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
cwd: E:\TRON\detectron_repo\
Complete output (16 lines):
running develop
running egg_info
writing detectron2.egg-info\PKG-INFO
writing dependency_links to detectron2.egg-info\dependency_links.txt
writing requirements to detectron2.egg-info\requires.txt
writing top-level names to detectron2.egg-info\top_level.txt
reading manifest file 'detectron2.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'detectron2.egg-info\SOURCES.txt'
running build_ext
error: [WinError 2] The system cannot find the file specified
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\E-soft\Anaconda3\envs\detectron_env\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\E-soft\Anaconda3\envs\detectron_env\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:\\TRON\\detectron_repo\\setup.py'"'"'; __file__='"'"'E:\\TRON\\detectron_repo\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
I've tried to get past the problem by changing build_ext to build_ext --inplace in setup.py (line 208):
cmdclass={"build_ext --inplace": torch.utils.cpp_extension.BuildExtension}
Here's the result of running step 14 with these changes applied:
(detectron_env) e:\TRON>pip install -q -e detectron_repo
ERROR: Command errored out with exit status 1:
command: 'C:\Users\E-soft\Anaconda3\envs\detectron_env\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:\\TRON\\detectron_repo\\setup.py'"'"'; __file__='"'"'E:\\TRON\\detectron_repo\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
cwd: E:\TRON\detectron_repo\
Complete output (17 lines):
running develop
running egg_info
writing detectron2.egg-info\PKG-INFO
writing dependency_links to detectron2.egg-info\dependency_links.txt
writing requirements to detectron2.egg-info\requires.txt
writing top-level names to detectron2.egg-info\top_level.txt
reading manifest file 'detectron2.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'detectron2.egg-info\SOURCES.txt'
running build_ext
building 'detectron2._C' extension
error: Don't know how to compile E:\TRON\detectron_repo\detectron2\layers\csrc\box_iou_rotated\box_iou_rotated_cuda.cu
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\E-soft\Anaconda3\envs\detectron_env\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
return stream.closed
ValueError: underlying buffer has been detached
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\E-soft\Anaconda3\envs\detectron_env\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'E:\\TRON\\detectron_repo\\setup.py'"'"'; __file__='"'"'E:\\TRON\\detectron_repo\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
It says "Don't know how to compile E:\TRON\detectron_repo\detectron2\layers\csrc\box_iou_rotated\box_iou_rotated_cuda.cu". What's the origin of the problem? Is it coming from Microsoft Visual Studio?
Context: macOS Catalina: pip3 install marisol returns:
Building wheels for collected packages: reportlab
Building wheel for reportlab (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/user/pyViutualEnv/marisol/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/pip-install-4sqwyoby/reportlab_8b45a6fc8e1f41dda74996813181243c/setup.py'"'"'; __file__='"'"'/private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/pip-install-4sqwyoby/reportlab_8b45a6fc8e1f41dda74996813181243c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/pip-wheel-s_xiwi84
cwd: /private/var/folders/5s/5j5833_j41q5jw5qg42h3h6w0000gn/T/pip-install-4sqwyoby/reportlab_8b45a6fc8e1f41dda74996813181243c/
Complete return: https://pastebin.com/raw/2HvMLVVt
What exactly is the problem and the remedy?
Update: macOS High Sierra: pip3 install marisol successfully installed and returned no errors
i wanted to install web3py using pip but it gives me errors
in one of the errors it says to install visual c++ 2014 but i already have it on my windows i thought maybe if I create a virtual env it fixes it but it didn't
any idea what is wrong?
by the way I am using python3.9.6
ERROR: Command errored out with exit status 1:
command: 'e:\programming\python\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\dark knigt\\AppData\\Local\\Temp\\pip-install-u076o94s\\bitarray_111d2831f9c54120bd3f0dd15ec559f2\\setup.py'"'"'; __file__='"'"'C:\\Users\\dark knigt\\AppData\\Local\\Temp\\pip-install-u076o94s\\bitarray_111d2831f9c54120bd3f0dd15ec559f2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\dark knigt\AppData\Local\Temp\pip-record-q0553zy8\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\programming\python\venv\include\site\python3.9\bitarray'
cwd: C:\Users\dark knigt\AppData\Local\Temp\pip-install-u076o94s\bitarray_111d2831f9c54120bd3f0dd15ec559f2\
Complete output (13 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\bitarray
copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\test_util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\__init__.py -> build\lib.win-amd64-3.9\bitarray
running build_ext
building 'bitarray._bitarray' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'e:\programming\python\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\dark knigt\\AppData\\Local\\Temp\\pip-install-u076o94s\\bitarray_111d2831f9c54120bd3f0dd15ec559f2\\setup.py'"'"'; __file__='"'"'C:\\Users\\dark knigt\\AppData\\Local\\Temp\\pip-install-u076o94s\\bitarray_111d2831f9c54120bd3f0dd15ec559f2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\dark knigt\AppData\Local\Temp\pip-record-q0553zy8\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\programming\python\venv\include\site\python3.9\bitarray' Check the logs for full command output.
I am trying to get postgresql up and running on my computer to use with python3. From what I understand, I have to download postgresql and then psycopg2. I used the command
brew install postgresql
which worked without any error. I then proceeded to do
pip3 install psycopg2
but got the error
ERROR: Could not find a version that satisfies the requirement pyscopg2 (from versions: none)
ERROR: No matching distribution found for pyscopg2
I know that psycopg2-binary exists, but I would rather not install it unless I have to.
EDIT:
Turns out as wu.guan.feng.yue pointed out, I had a typo (fixed now). Unfortunately, I just got another error.
Collecting psycopg2
Using cached psycopg2-2.9.1.tar.gz (379 kB)
Using legacy 'setup.py install' for psycopg2, since package 'wheel' is not installed.
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-install-w901ehls/psycopg2_8dfb1124ccd54b17b1211b191de99482/setup.py'"'"'; __file__='"'"'/private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-install-w901ehls/psycopg2_8dfb1124ccd54b17b1211b191de99482/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-record-x11loqj9/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/psycopg2
cwd: /private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-install-w901ehls/psycopg2_8dfb1124ccd54b17b1211b191de99482/
Complete output (34 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
creating build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.9/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/psycopg
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_VERSION=2.9.1 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=130003 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I. -I/usr/local/include -I/usr/local/include/postgresql/server -I/usr/local/Cellar/icu4c/69.1/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/readline/include -c psycopg/adapter_asis.c -o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_asis.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-install-w901ehls/psycopg2_8dfb1124ccd54b17b1211b191de99482/setup.py'"'"'; __file__='"'"'/private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-install-w901ehls/psycopg2_8dfb1124ccd54b17b1211b191de99482/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/zb/6bvbfsfn6fqdl6wzjp52ykj80000gn/T/pip-record-x11loqj9/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/psycopg2 Check the logs for full command output.
You might have a typo "pscyopg2". Do you mean by pip3 install psycopg2?
Alright, I found the answer. I noticed one line of the error said
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I looked it up finding this question: Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools).
Turned out the problem was that I needed to run the command
xcode-select --install
in order to update the Xcode Command-line Tools.
Collecting python-decouple
Using cached python-decouple-3.3.tar.gz (10 kB)
Using legacy setup.py install for python-decouple, since package 'wheel' is not installed.
Installing collected packages: python-decouple
Running setup.py install for python-decouple ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"'; __file__='"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\slms_\AppData\Local\Temp\pip-record-aljfw6bc\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\python-decouple'
cwd: C:\Users\slms_\AppData\Local\Temp\pip-install-awe0dvrf\python-decouple\
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build\lib
copying decouple.py -> build\lib
running egg_info
writing python_decouple.egg-info\PKG-INFO
writing dependency_links to python_decouple.egg-info\dependency_links.txt
writing top-level names to python_decouple.egg-info\top_level.txt
reading manifest file 'python_decouple.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_decouple.egg-info\SOURCES.txt'
running install_lib
byte-compiling c:\python38\Lib\site-packages\decouple.py to decouple.cpython-38.pyc
error: [Errno 13] Permission denied: 'c:\\python38\\Lib\\site-packages\\__pycache__\\decouple.cpython-38.pyc.2802584858032'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"'; __file__='"'"'C:\\Users\\slms_\\AppData\\Local\\Temp\\pip-install-awe0dvrf\\python-decouple\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\slms_\AppData\Local\Temp\pip-record-aljfw6bc\install-rec
You obviously lack permissions to make the install you could use a venv or run cmd as an admin (idk I don't use windows)
to set up a venv run the following command in your projects directory whenever you start cmd
C:\> python3 -m venv ./.venv
and then run your install script