"use_2to3 is invalid" when installing pybluez package [duplicate] - python

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

Related

issues of installing mujoco and baseline library

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

Mac M1 Can't Install PyAudio / Tried All Answers Suggested in StackOverflow [duplicate]

This question already has answers here:
Unable to install PyAudio on M1 Mac [PortAudio already installed]
(8 answers)
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Mac M1 Can't Install PyAudio | Need Microphone for Google Speech Recognition:
Please note below I have outlined answers that have seemed to work for others that have not worked for me.
Below is the error code:
WARNING: Discarding https://files.pythonhosted.org/packages/d0/dc/ffb9ce5e3f19bd289902915a9f68b7d199216065f8ea17d5b5e8e4ad86ee/PyAudio-0.2.9.tar.gz#sha256=bfd694272b3d1efc51726d0c27650b3c3ba1345f7f8fdada7e86c9751ce0f2a1 (from https://pypi.org/simple/pyaudio/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached pyaudio-0.2.8.tar.gz (235 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/setup.py'"'"'; file='"'"'/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/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/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-pip-egg-info-nt0b4dbj
cwd: /private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/
Complete output (15 lines):
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/lw/_gcm85s107z9sbgqyrw5pw700000gn/T/pip-install-p8wmnhcz/pyaudio_38ac896d11214f37bec552d23eaf6dfc/setup.py", line 124, in
setup(name = 'PyAudio',
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 776, in parse_config_files
self._parse_config_files(filenames=filenames)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 648, in _parse_config_files
parser.read_file(reader)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/configparser.py", line 719, in read_file
self._read(f, source)
WARNING: Discarding https://files.pythonhosted.org/packages/06/d1/3d202c9187fb78ad6d4f8b476a8cc0ded7c1b47ca33d5dab73b959faf123/pyaudio-0.2.8.tar.gz#sha256=4f85367cf79657616684487037957ac38582ecc5389b89420fe61d901b719551 (from https://pypi.org/simple/pyaudio/). 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 pyaudio (from versions: 0.2.8, 0.2.9, 0.2.10, 0.2.11)
ERROR: No matching distribution found for pyaudio
WARNING: You are using pip version 21.3; however, version 21.3.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip' command.
Please note what was attempted through answers on stackoverflow and other-sites that has not worked for me.
brew update
brew install portaudio
brew link --overwrite portaudio
pip install pyaudio
##Use the command to install PortAudio
sudo brew install portaudio
##After successful installation of PortAudio, enter the following command.
sudo nano $HOME/.pydistutils.cfg
##Next, enter the following lines in the opened window
[build_ext]
include_dirs=/Users//homebrew/Cellar/portaudio/19.20140130/include/
include_dirs=/Users//homebrew/Cellar/portaudio/19.20140130/lib/
Finally run the command
pip install pyaudio
or
pip3 install pyaudio
Any help would be greatly appreciated. Thank you.
install brew on your M1 machine from here
How to install homebrew on M1 mac
And then enter this commands :
brew update
brew install portaudio
brew link --overwrite portaudio
pip install pyaudio
you can also check this :
Unable to install PyAudio on M1 Mac [PortAudio already installed]

Python / Tox action in Github no longer runs due to use_2to3 error [duplicate]

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

How to fix error during pythonnet installation

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.

Pip error installing PyObjC-core on mac OS 10.13.6

Hi currently i had PyObjC-core as one of the dependencies in my requirements.txt file, when i try to run
pip install -r requirements.txt
it return the following error:
Collecting pyobjc-core==6.1
Using cached https://files.pythonhosted.org/packages/3a/80/0cdb2130b86a984e4765beb93135aa9c2120fd64be1a27e1c7cb31c719bc/pyobjc-core-6.1.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vj52r5i1/pyobjc-core/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vj52r5i1/pyobjc-core/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-vj52r5i1/pyobjc-core/pip-egg-info
cwd: /tmp/pip-install-vj52r5i1/pyobjc-core/
Complete output (2 lines):
running egg_info
error: PyObjC requires macOS to build
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I looked for solutions online but still haven't found any answers.
my pip version is 20.0.2 and running on python 3.7
I also had tried with manual install pip install pyobjc-core but still no luck
As mentioned also here https://github.com/asweigart/pyautogui/issues/381, I believe currently the only solution is installing an older release of pyautogui:
https://pypi.org/project/PyAutoGUI/0.9.50/#history.
For instance: pip3 install PyAutoGUI==0.9.48
I came here with a slightly different error when trying to pip install pyobjc-core latest (8.1) on MacOS 10.15.7. If you are seeing the following compilation error from gcc ...
Modules/objc/OC_PythonNumber.m:553:39: error: unused parameter 'zone' [-Werror,-Wunused-parameter]
... then I would refer you to [this issue] on github 1

Categories

Resources