Requirements.txt file failing with a Git repo source - python

I have this requirements file:
requests==2.24.0
-e git+ssh://git#omyurl/path/to/mygit.git#egg=mymodule
Ad when I pip install -r requirements.txt -t some/folder, I get:
ERROR: Command errored out with exit status 1:
command: /../.pyenv/versions/3.7.5/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/../src/mymodule/setup.py'"'"'; __file__='"'"'/../src/mymodule/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --home=/private/var/folders/14/xyz/T/pip-target-9ag4c8zg
cwd: /../src/mymodule/
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 --home not recognized
When I go the long route and bring the repo down and pip install -e . -t some/folder, I get the same error. But when I pip install . -t some/folder, no errors. Any idea how to make this work with requirements.txt?

This should not be anything more than a python bug . A possible solution to the problem would be removing the -t from your pip install -r requirements.txt -t some/folder .
The problem has occurred before and a little search on the internet would take you here.
Edit: The answer to this was removing -e from requirements.txt.

Related

FastAPI "ERROR: Failed building wheel for python-multipart" in basic "hello world" tutorial

I follow the FastAPI "hello world" tutorial. As step 1, I need to run (I use python 3.8 in a venv):
pip install "fastapi[all]"
but I get:
Building wheels for collected packages: python-multipart
Building wheel for python-multipart (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: venv/my_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u0lo92at/python-multipart/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u0lo92at/python-multipart/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-f5_nolf4
cwd: /tmp/pip-install-u0lo92at/python-multipart/
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: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for python-multipart
Running setup.py clean for python-multipart
Failed to build python-multipart
When I go over to step 2, it says:
$ uvicorn main:app --reload
Command 'uvicorn' not found, but can be installed with:
sudo apt install uvicorn
although uvicorn is said to be installed with the command in the first place:
What should I do to run uvicorn main:app --reload?
Just install it again.
pip install "fastapi[all]"
Afterwards, you can run
uvicorn main:app --reload
without further installations.

How to fix `error: invalid command 'bdist_wheel'`?

I try to install watchman on Ubuntu 20.04.01:
guettli#yoga15:~/tmp$ python3 -m venv pywatchman-test
guettli#yoga15:~/tmp$ cd pywatchman-test
guettli#yoga15:~/tmp/pywatchman-test$ . bin/activate
(pywatchman-test) guettli#yoga15:~/tmp/pywatchman-test$ pip install pywatchman
Fails:
Collecting pywatchman
Using cached pywatchman-1.4.1.tar.gz (29 kB)
Building wheels for collected packages: pywatchman
Building wheel for pywatchman (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/guettli/tmp/pywatchman-test/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"'; __file__='"'"'/tmp/pip-install-on_zbadt/pywatchman/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9np2rv_b
cwd: /tmp/pip-install-on_zbadt/pywatchman/
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: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for pywatchman
Running setup.py clean for pywatchman
Failed to build pywatchman
Installing collected packages: pywatchman
Running setup.py install for pywatchman ... done
Successfully installed pywatchman-1.4.1
I found a way to solve this: If I uninstall pywatchman and install wheel it works fine.
I would like to create a patch for watchman, so that this works right of the box.
How could this be solved, so that in future this does not happen any more?
Related: https://github.com/facebook/watchman/issues/876
Running
pip install wheel
or
pip3 install wheel
or
python3 -m pip install wheel
solved the issue for me

unable to install autotest in ubuntu environment

I am trying to install autotest in ubuntu environment.
$ pip3 install autotest==0.16.4
After I execute I get the following error:
python3 -m pip install autotest==0.16.4
Defaulting to user installation because normal site-packages is not writeable
Collecting autotest==0.16.4
Using cached autotest-0.16.4.tar.gz (11.3 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cw5xzm8k/autotest/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cw5xzm8k/autotest/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-pip-egg-info-8yy0dvmj
cwd: /tmp/pip-install-cw5xzm8k/autotest/
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: invalid command 'egg_info'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
$ python3 --version
Python 3.7.8
$ pip -V
pip 20.1.1 from /home/ubuntu/.local/lib/python3.7/site-packages/pip (python 3.7)
try:
sudo pip3 install autotest==0.16.4
The error is that it cannot write to destination, most probably due to permissions.

How to fix "error: option --single-version-externally-managed not recognized"

I'll note up front that I've seen the related thread, and I've tried installing everything recommended: setuptools, wheel, egg, but I'm still getting the same error.
I'm running into the error while trying to install Picard:
C:\>pip install picard
Collecting picard
Using cached https://files.pythonhosted.org/packages/e8/ec/e76d4a84d37e6bd93789bf8f7a15f9e63f94cbc8b79607a2152b3fcc313f/picard-2.1.tar.gz
Requirement already satisfied: PyQt5 in c:\program files\python37\lib\site-packages (from picard) (5.12.2)
Requirement already satisfied: mutagen in c:\program files\python37\lib\site-packages (from picard) (1.42.0)
Requirement already satisfied: PyQt5_sip<13,>=4.19.14 in c:\program files\python37\lib\site-packages (from PyQt5->picard) (4.19.17)
Building wheels for collected packages: picard
Building wheel for picard (setup.py) ... error
ERROR: Complete output from command 'c:\program files\python37\python.exe' -u-c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\bdb484\\AppData\\Local\\Temp\\pip-install-lc47_c7l\\picard\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\bdb484\AppData\Local\Temp\pip-wheel-7ktnx238' --python-tag cp37:
ERROR: running bdist_wheel
running build
generating scripts/picard from scripts/picard.in
error: [Errno 2] No such file or directory: 'installer/picard-setup.nsi.in'
----------------------------------------
ERROR: Failed building wheel for picard
Running setup.py clean for picard
Failed to build picard
Installing collected packages: picard
Running setup.py install for picard ... error
ERROR: Complete output from command 'c:\program files\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\bdb484\\AppData\\Local\\Temp\\pip-install-lc47_c7l\\picard\\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\bdb484\AppData\Local\Temp\pip-record-wwek3m3r\install-record.txt' --single-version-externally-managed --compile:
ERROR: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command "'c:\program files\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\bdb484\\AppData\\Local\\Temp\\pip-install-lc47_c7l\\picard\\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\bdb484\AppData\Local\Temp\pip-record-wwek3m3r\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\bdb484\AppData\Local\Temp\pip-install-lc47_c7l\picard\
I've been googling around for a while without luck.
Any ideas?
The problem is that the windows-specific part of setup.py at https://github.com/metabrainz/picard/blob/d141f019c2b88ab6a3a21c04110dad0522e36616/setup.py#L225-L236, in particular
generate_file('installer/picard-setup.nsi.in', 'installer/picard-setup.nsi', args)
tries to generate installer/picard-setup.nsi from installer/picard-setup.nsi.in. However, the source tarball on PyPI doesn't even include the installer directory:
↪ tar tf picard-2.1.tar.gz | grep installer
↪
We've worked on the source distributions a bit last year (https://tickets.metabrainz.org/browse/PICARD-1373), but so far have only tested them on Linux.
If you want to use Picard on Windows, use the installer from https://picard.musicbrainz.org/downloads/.
error: [Errno 2] No such file or directory: 'installer/picard-setup.nsi.in'
This is a bug in the setup.py: it tries to generate a file without creating the directory installer first. Please report the bug to the authors. Try to install from the repository:
pip install git+https://github.com/metabrainz/picard.git#egg=picard
error: option --single-version-externally-managed not recognized
This is an option for python setup.py install. Try to run python setup.py install --help with any setup.py and see if it has
--single-version-externally-managed used by system package builders to
create 'flat' eggs
near the end.

Unable to install MySQL-python " invalid command 'egg_info' "

I'm getting a weird error after running
$ pip install mysql-python
Has anyone seen an error like this with "egg_info" being invalid?
I'm running OSX mountain lion
Downloading/unpacking MySQL-python
Using download cache from /Users/Marcus/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FM%2FMySQL-python%2FMySQL-python-1.2.4.zip
Running setup.py egg_info for package MySQL-python
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /var/folders/ss/nxvs3w690xqbpvr_l0v31mrw0000gn/T/tmpg_MvY6
Now working in /var/folders/ss/nxvs3w690xqbpvr_l0v31mrw0000gn/T/tmpg_MvY6/distribute-0.6.28
Building a Distribute egg in /Users/Marcus/sites/venv/build/MySQL-python
/Users/Marcus/sites/venv/build/MySQL-python/distribute-0.6.28-py2.7.egg
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /var/folders/ss/nxvs3w690xqbpvr_l0v31mrw0000gn/T/tmpg_MvY6
Now working in /var/folders/ss/nxvs3w690xqbpvr_l0v31mrw0000gn/T/tmpg_MvY6/distribute-0.6.28
Building a Distribute egg in /Users/Marcus/sites/venv/build/MySQL-python
/Users/Marcus/sites/venv/build/MySQL-python/distribute-0.6.28-py2.7.egg
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'egg_info'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/Marcus/sites/venv/build/MySQL-python
Storing complete log in /Users/Marcus/.pip/pip.log
Thanks
--- I'm getting this same error when I run
$ pip install django
You need distribute package which is now inside setuptools:
pip install --upgrade setuptools

Categories