elbillaf
elbillaf

Reputation: 1984

pip install is not recognizing a previously installed package

I'm trying to create a standard virtual environment for a project. I have a working virtual environment with all the required modules. I have a batch file to install the required stuff.

A portion of the batch code looks like this:

pip install --no-index "altgraph-0.17-py2.py3-none-any.whl"
pip install --no-index "pefile-2017.8.1.zip"
pip install --no-index "pywin32_ctypes-0.2.0-py2.py3-none-any.whl"

pip install --no-index "setuptools-40.8.0-py2.py3-none-any.whl "
pip install --no-index "PyInstaller-3.6.tar.gz"

When I run this, I get the following error:

(py368) C:\Users\kgreen\Source\Repos\MapTools\py368_modules>pip install --no-index "PyInstaller-3.6.tar.gz"
Processing c:\users\kgreen\source\repos\maptools\py368_modules\pyinstaller-3.6.tar.gz
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\kgreen\source\repos\maptools\py368\scripts\python.exe' 'c:\users\kgreen\source\repos\maptools\py368\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\kgreen\AppData\Local\Temp\pip-build-env-fcj_djos\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (2 lines):
  ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0
  ERROR: No matching distribution found for setuptools>=40.8.0
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\kgreen\source\repos\maptools\py368\scripts\python.exe' 'c:\users\kgreen\source\repos\maptools\py368\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\kgreen\AppData\Local\Temp\pip-build-env-fcj_djos\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

But that is exactly the version of setuptools I installed! I had previously tried setuptools-41.4.0 and when that didn't work I tried going back to the exact version they error message mentions.

Note: I get the same error when I try to install gazpacho later on ... fails to recognize that setuptools>=40.8.0 is already installed.

Note: When I do a pip list, I see that the correct version of setuptools has indeed been installed.

(edit) Note: I forgot to mention that this must also work for systems that are not connected to the Internet, and so the solution must point to wheel files or zips, but not directly to PyPi.

I also tried manually typing the install after the fact, thinking maybe it need a delay to finish doing some processing on the prior install of setuptools. (maybe silly, but I desperate.) Why doesn't it see that version? How can I fix this?

Upvotes: 3

Views: 2570

Answers (2)

gch
gch

Reputation: 101

I had the same problem when I was trying to install atlassian-python-api. Looks that it is problem with pip (from version 10), if trying to install packages offline (with --no-index flag). I found solution on PyInstaller github: https://github.com/pyinstaller/pyinstaller/issues/4557#issuecomment-569450071 ("PEP517 suggests that the package build should be done on an isolated environment which pip does by using --ignore-installed")

So just add --no-build-isolation flag to pip command:

pip install --no-index --find-links "PyInstaller-3.6.tar.gz" --no-build-isolation

Maybe you will need also to install wheel package. See details here: Why is python setup.py saying invalid command 'bdist_wheel' on Travis CI?

Upvotes: 3

J.C.
J.C.

Reputation: 69

could you try with "--find-links" ?

pip install --no-index --find-links "PyInstaller-3.6.tar.gz"

This means install your local package and install other required package from pypi. If your pip install a "setuptools-40.8.0" successful, your fault. But for ignoring installing setuptools, maybe some packages are broken.

Upvotes: 1

Related Questions