When I try to use following command:
pip install pythonnet
I see error that you can see below:
Collecting pythonnet
Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Requirement already satisfied: pycparser in c:\users\d4wt0\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pythonnet) (2.20)
Using legacy 'setup.py install' for pythonnet, since package 'wheel' is not installed.
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\d4wt0\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\d4wt0\\AppData\\Local\\Temp\\pip-install-jlv07504\\pythonnet_0928bad80975481c9950abc5017a28b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\d4wt0\\AppData\\Local\\Temp\\pip-install-jlv07504\\pythonnet_0928bad80975481c9950abc5017a28b4\\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\d4wt0\AppData\Local\Temp\pip-record-x2n0fvt3\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\d4wt0\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet'
cwd: C:\Users\d4wt0\AppData\Local\Temp\pip-install-jlv07504\pythonnet_0928bad80975481c9950abc5017a28b4\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\d4wt0\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\d4wt0\\AppData\\Local\\Temp\\pip-install-jlv07504\\pythonnet_0928bad80975481c9950abc5017a28b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\d4wt0\\AppData\\Local\\Temp\\pip-install-jlv07504\\pythonnet_0928bad80975481c9950abc5017a28b4\\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\d4wt0\AppData\Local\Temp\pip-record-x2n0fvt3\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\d4wt0\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pythonnet' Check the logs for full command output.
How can I fix it? I tried to install that package using PyCharm, but there is the same error. Any ideas?
From the Python.NET docs I can see it doesn't support python 3.9. You can download wheel file from
here.
As your python version is 3.9, download pythonnet‑2.5.2‑cp39‑cp39‑win32.whl (for 32-bit python version) or pythonnet‑2.5.2‑cp39‑cp39‑win_amd64.whl (for 64-bit python version).
Then specify a full path to wheel file for installation.
Example:
pip install C:\Users\User\Downloads\pythonnet‑2.5.2‑cp39‑cp39‑win_amd64.whl
The current pre-release version supports Python 3.9. It can be installed with pip using:
pip install --pre pythonnet
(This answer came from https://github.com/pythonnet/pythonnet/issues/1262.)
Split this out of [SO]: pywebview installing Error Python windows 10 (Python 3.10.5) "pip install pywebview" (#CristiFati's answer).
You're using Python 3.9.
According to [PyPI]: pythonnet - Release history, latest released version (at answer time) is v2.5.2. Unfortunately, highest Python version that the .whls are built for is v3.8. Since there is no .whl for your version, it tries to build it from source, and that's where it fails.
To get past this, you could either:
Use an older Python version (v3.8) that has all the packages built for it. Everything should work OOTB.
The drawback is obvious, older versions are only receiving security updates and will go out of support sooner, and some packages (newer versions) might no longer support them.
Install / build it manually (python -m pip install pythonnet)
Install v3.0.0rc6 (!!! PRE RELEASE !!!) available at original answer time (check the end of this section). Pass --pre flag to PIP, as instructed in [GitHub]: pythonnet/pythonnet - Troubleshooting on Windows, Linux, and OSX:
pip install pythonnet [--pre] -U (--pre gets the latest development build uploaded to PyPI)
So, the command line should be: python -m pip install --pre pythonnet.
Or specify the version directly: pip install pythonnet==3.0.0rc6.
On 220929, PythonNET 3.0.0 was released!.
You can use that one from now on. It's one .whl only (doesn't seem to be tied to Python versions).
Find a 3rd-party repository that has prebuilt .whls for newer Python versions:
[GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PythonNET/v2.5.2 (see below)
[UCI.LFD]: Unofficial Windows Binaries for Python Extension Packages - PythonNET, provide integration with the .NET Common Language Runtime (CLR) and an application scripting tool for .NET.
Build v2.5.2. But the process is shitty (it has been much improved in v3), as it requires lots of stuff:
MSBuild - installed by VStudio (but I think it can also be installed standalone)
CLang - can be installed standalone, but also by other software like:
Android Studio
Nix emulators (MinGW, MSYS2, Cygwin, ...)
Some environment variables being set
A file needs to be patched
I did all of the above (and published the binaries in the GitHub URL mentioned in the answer).
Update #0
Built .whls and published them on [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PythonNET/v2.5.2 (win_amd64 and win32 for Python: v3.11, v3.10, v3.9). Check [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 (#CristiFati's answer) (Shortcut section - at the end) details regarding custom .whl installation.
The only test I did is import clr (successful - no crash or error) in the interpreter console.
Related
version pip 21.2.4
python 3.6
The command:
pip install -r requirements.txt
The content of my requirements.txt:
mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes
The command is failing with this error
ERROR: Command errored out with exit status 1:
command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/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'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
Complete output (1 lines):
error in mongoengine setup command: use_2to3 is invalid.
----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1
It looks like setuptools>=58 breaks support for use_2to3:
setuptools changelog for v58
So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.
I was having the same problem, pip==19.3.1
I install setuptools==58It worked for me. pip install setuptools==58. The error coming from setuptools==69 that previously run on my device. and Finally saved me setuptools version 58 for this error.
This worked for me.
pip install --upgrade pip setuptools==57.5.0
"pip install setuptools==58" worked for me. The setuptools version was 59 when I upgraded ubuntu to 22.04 and its python 3.10. I started a clean virtual environment for an existings django project. It had just two packages:
`pip list
Package Version
pip 22.0.2
setuptools 59.6.0`
Then I downgrade the setuptools to 58 as pip install setuptools==58.0.0. After that the pip install -r requirements.txt has not such error above.
Upgrading MongoEngine to >= 0.20 would also fix the problem as Python2 support (hence use_2to3) was dropped in 0.20
I'm working on Windows 11 and these solutions didn't work. I installed pybluez2 instead. Your python version >= 3.9 on Windows.
pip install pybluez2
according the following paragraph Vectorized Environment,
i wanted to install library baselines, first time it told me that i should install mujoco, i have searched across internet information about this library and found that i could install it using following command
pip install free-mujoco-py
but i got following errors :
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source
of the following dependency conflicts.
yellowbrick 1.3.post1 requires numpy<1.20,>=1.16.0, but you have numpy 1.22.1 which is incompatible.
tensorflow 2.6.0 requires numpy~=1.19.2, but you have numpy 1.22.1 which is incompatible.
actually mujoco-py is installed i can call it using
import mujoco_py
but when i have tried
pip install baselines
i got :
Building wheel for mujoco-py (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\User\PycharmProjects\MachineLearning\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys
.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-gibatj1_\\mujoco-py_ec86452e9e9f4ec2b2c6293e0dac635a\\setup.py'"'"';
__file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-gibatj1_\\mujoco-py_ec86452e9e9f4ec2b2c6293e0dac635a\\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 '
C:\Users\User\AppData\Local\Temp\pip-wheel-f0q_yw3t'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-gibatj1_\mujoco-py_ec86452e9e9f4ec2b2c6293e0dac635a\
Complete output (54 lines):
running bdist_wheel
running build
You appear to be missing MuJoCo. We expected to find the file here: C:\Users\User\.mujoco\mjpro150
This package only provides python bindings, the library must be installed separately.
what happens? please help me
i think that the problem is about the version of numpy
pip install numpy==1.19.2
Can solve your problem about your installation problem
version pip 21.2.4
python 3.6
The command:
pip install -r requirements.txt
The content of my requirements.txt:
mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes
The command is failing with this error
ERROR: Command errored out with exit status 1:
command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/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'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
Complete output (1 lines):
error in mongoengine setup command: use_2to3 is invalid.
----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1
It looks like setuptools>=58 breaks support for use_2to3:
setuptools changelog for v58
So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.
I was having the same problem, pip==19.3.1
I install setuptools==58It worked for me. pip install setuptools==58. The error coming from setuptools==69 that previously run on my device. and Finally saved me setuptools version 58 for this error.
This worked for me.
pip install --upgrade pip setuptools==57.5.0
"pip install setuptools==58" worked for me. The setuptools version was 59 when I upgraded ubuntu to 22.04 and its python 3.10. I started a clean virtual environment for an existings django project. It had just two packages:
`pip list
Package Version
pip 22.0.2
setuptools 59.6.0`
Then I downgrade the setuptools to 58 as pip install setuptools==58.0.0. After that the pip install -r requirements.txt has not such error above.
Upgrading MongoEngine to >= 0.20 would also fix the problem as Python2 support (hence use_2to3) was dropped in 0.20
I'm working on Windows 11 and these solutions didn't work. I installed pybluez2 instead. Your python version >= 3.9 on Windows.
pip install pybluez2
I was bored recently so I decided to do some programming and follow this tutorial which seemd interesting: https://www.youtube.com/watch?ev=8gPONnGIPgw&t=244s
During it, he installs the autopy module directly from pycharm, however when I try it directly myself from the settings in pycharm it doesn't work and I receive an error.
To combat this I decided to follow the instructions on the main site: https://pypi.org/project/autopy/
I tried the first
pip install autopy
command directly and got a massive error where it first said it failed to build the wheel, and then when it ran the second part setup.py it also gave a massive error saying it also failed.
From there I went to the second option:
rustup default nightly-2019-10-05
pip install -U setuptools-rust
pip install -U autopy
by installing rustup and running the other commands but it still fails and gives the "failed to build wheel" and setup.py failed error messages, the exact same ones as before.
Finally I tried the third option:
git clone git://github.com/autopilot-rs/autopy-rs.git
cd autopy
make
make install
by downloading the repository itself and then going into it and using make(that I installed via chocolatey in the powershell) and running these commands but it also fails.
I've tried all 3 methods and the internet is yielding minimum results, any help here or resources that may help is greatly appreciated.
EDIT:
my apologies I thought I added the error, here it is
Collecting autopy
Using cached autopy-4.0.0.tar.gz (20 kB)
Building wheels for collected packages: autopy
Building wheel for autopy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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 'C:\Users\moham\AppData\Local\Temp\pip-wheel-bt_24b82'
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97\
Complete output (21 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\autopy
copying autopy\__init__.py -> build\lib\autopy
running build_ext
running build_rust
error: no override and no default toolchain set
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
----------------------------------------
ERROR: Failed building wheel for autopy
Running setup.py clean for autopy
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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'"'"'))' clean --all
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97
Complete output (18 lines):
running clean
removing 'build\lib' (and everything under it)
'build\bdist.win-amd64' does not exist -- can't clean it
'build\scripts-3.9' does not exist -- can't clean it
removing 'build'
running clean_rust
error: no override and no default toolchain set
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
----------------------------------------
ERROR: Failed cleaning build dir for autopy
Failed to build autopy
Installing collected packages: autopy
Running setup.py install for autopy ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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\moham\AppData\Local\Temp\pip-record-lgc9_ekn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\moham\appdata\local\programs\python\python39\Include\autopy'
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97\
Complete output (21 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\autopy
copying autopy\__init__.py -> build\lib.win-amd64-3.9\autopy
running build_ext
running build_rust
error: no override and no default toolchain set
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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\moham\AppData\Local\Temp\pip-record-lgc9_ekn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\moham\appdata\local\programs\python\python39\Include\autopy' Check the logs for full command output.
Looking at the repository for AutoPy, I've found this issue here
Have you tried to use pip install autopy3 for python 3 and above?
Furthermore, autopy uses rust cargo, you can try to clone the following repo and try to build it with Rust (cargo build) on your platform?
I've tried to type this command:
pip3 install --user psycopg2 psycopg2-binary
Bash answers:
ERROR: running install
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
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-install-i0kg4ysj/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-record-lkzzuu55/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-install-i0kg4ysj/psycopg2/
You're not being able to install psycopg2 as the gcc compiler in your device is either outdated and not compatible to install and run it, or it does not exist.
if you just run pip install psycopg2-binary, then it will work on your development and testing environment, however it is not recommended for production.
To install psycopg2, make sure that you have gcc installed in your device by running-
gcc --version
gcc where
If it is not installed, then install it by referring to the guide here-
Installing GCC in Mac
I hope this helps. :)
after successfully installed python and pip, this command should work:
pip install psycopg2