pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.84k stars 1.86k forks source link

pipenv fails to install all my packages, and then installs all of them #1356

Closed jacek-jablonski closed 2 years ago

jacek-jablonski commented 6 years ago

Hi, it might be something that I do not understand or so. I have 2 sources specified and none of them is official pypi, but mirrors, so here is my Pipfile:

[[source]]

url = "https://company/api/pypi/pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[[source]]

url = "https://company/api/pypi/pypi-local/simple"
verify_ssl = true
name = "pypi-local"

[packages]

cachetools = "==2.0.1"
click = "==6.2"
data-object = "==1.2.1"
flask-cache = "==0.13.1"
flask-classy = "==0.6.10"
flask-humanize = "==0.3.0"
flask-migrate = "==2.1.1"
flask-oauthlib = "==0.9.4"
flask-sqlalchemy = "==2.3.2"
flask-wtf = "==0.14.2"
flask = "==0.12.2"
huey = "==1.6.0"
pendulum = "==1.4.0"
pyyaml = "==3.12"
redis = "==2.10.6"
requests = "==2.18.4"
requests-cache = "==0.4.13"
sqlalchemy = "==1.2.1"
whitenoise = "==3.3.1"
gunicorn = "==19.7.1"

[dev-packages]

ipdb = "*"
ipython = "*"
flask-shell-ipython = "*"
coverage = "*"
flake8 = "*"
flask-debugtoolbar = "*"
Describe your environment
  1. OS Type Ubuntu
  2. Python version: $ python -V Python 3.6.1
  3. Pipenv version: $ pipenv --version pipenv, version 9.0.3
Expected result

All packages installed immediatly.

Actual result
Installing dependencies from Pipfile.lock (7e9249)…
An error occurred while installing blinker==1.4! Will try again.
An error occurred while installing click==6.2! Will try again.
An error occurred while installing coverage==4.4.2! Will try again.
An error occurred while installing decorator==4.2.1! Will try again.
An error occurred while installing flask-debugtoolbar==0.10.1! Will try again.
An error occurred while installing flask-shell-ipython==0.3.0! Will try again.
An error occurred while installing ipdb==0.10.3! Will try again.
An error occurred while installing ipython==6.2.1! Will try again.
An error occurred while installing ipython-genutils==0.2.0! Will try again.
An error occurred while installing jedi==0.11.1! Will try again.
An error occurred while installing parso==0.1.1! Will try again.
An error occurred while installing pexpect==4.3.1; sys_platform != 'win32'! Will try again.
An error occurred while installing pickleshare==0.7.4! Will try again.
An error occurred while installing prompt-toolkit==1.0.15! Will try again.
An error occurred while installing ptyprocess==0.5.2! Will try again.
An error occurred while installing pygments==2.2.0! Will try again.
An error occurred while installing simplegeneric==0.8.1! Will try again.
An error occurred while installing traitlets==4.3.2! Will try again.
An error occurred while installing wcwidth==0.1.7! Will try again.
Installing initially–failed dependencies…
Success installing blinker==1.4!
Success installing click==6.7!
Success installing coverage==4.4.2!
Success installing decorator==4.2.1!
Success installing flask-debugtoolbar==0.10.1!
Success installing flask-shell-ipython==0.3.0!
Success installing ipdb==0.10.3!
Success installing ipython==6.2.1!
Success installing ipython-genutils==0.2.0!
Success installing jedi==0.11.1!
Success installing parso==0.1.1!
Success installing pexpect==4.3.1; sys_platform != 'win32'!
Success installing pickleshare==0.7.4!
Success installing prompt-toolkit==1.0.15!
Success installing ptyprocess==0.5.2!
Success installing pygments==2.2.0!
Success installing simplegeneric==0.8.1!
Success installing traitlets==4.3.2!
Success installing wcwidth==0.1.7!
Steps to replicate

pipenv install --system Please also note, that pipenv is installing click==6.7 despite specifying 6.2 version.

theDreamer911 commented 3 years ago

if you still got the error please try using this

python3 -m ensurepip --upgrade or py -m ensurepip --upgrade

It will upgrade the pip, and also fix my problem

artctv commented 3 years ago

pipenv shell and then pip install --upgrade setuptools (for python 3.7.4) solved for me

zStupan commented 3 years ago

I had the same issue. Deleting the pipenv cache directory solved it for me (https://pipenv.pypa.io/en/latest/diagnose/#your-dependencies-could-not-be-resolved)

prensoni0143 commented 3 years ago

GH5:cloud-comer i5$ pip install --upgrade setuptools /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography import x509 Collecting setuptools Using cached https://files.pythonhosted.org/packages/e1/b7/182161210a13158cd3ccc41ee19aadef54496b74f2817cc147006ec932b4/setuptools-44.1.1-py2.py3-none-any.whl Installing collected packages: setuptools Found existing installation: setuptools 41.0.1 Uninstalling setuptools-41.0.1: Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/private/var/folders/sw/8d0w0rtj4_v81v6g586q74fm0000gn/T/pip-uninstall-cQKNTb/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/easy_install.py'

By the way, I thought I am running Python 3

$ python

WARNING: Python 2.7 is not recommended. This version is included in macOS for compatibility with legacy software. Future versions of macOS will not include Python 2.7. Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, May 8 2021, 11:48:02) [GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin Type "help", "copyright", "credits" or "license" for more information.

Jayesh-ux commented 2 years ago

Same i am getting error installating all of my package alembic==1.4.2 appdirs==1.4.4 asgiref==3.2.10 Babel==2.8.0 bcrypt==3.1.7 blinker==1.4 buildozer==1.2.0 cffi==1.14.0 click==7.1.2 cryptography==2.9.2 distlib==0.3.0 dj-database-url==0.5.0 Django==3.0.8 django-crispy-forms==1.9.2 django-heroku==0.3.1 django-mathfilters==1.0.0 dnspython==1.16.0 email-validator==1.1.1 filelock==3.0.12 Flask==1.0.2 Flask-BabelEx==0.9.4 Flask-Compress==1.4.0 Flask-Gravatar==0.5.0 Flask-Login==0.4.1 Flask-Mail==0.9.1 Flask-Migrate==2.4.0 Flask-Paranoid==0.2.0 Flask-Principal==0.4.0 Flask-Security-Too==3.4.3 Flask-SQLAlchemy==2.4.1 Flask-WTF==0.14.3 gunicorn==20.0.4 idna==2.10 itsdangerous==1.1.0 Jinja2==2.11.2 ldap3==2.7 Mako==1.1.3 MarkupSafe==1.1.1 paramiko==2.7.1 passlib==1.7.2 pexpect==4.8.0 pgadmin4==4.23 Pillow==7.2.0 psutil==5.7.0 psycopg2==2.8.5 psycopg2-binary==2.8.5 ptyprocess==0.6.0 pyasn1==0.4.8 pycparser==2.20 PyNaCl==1.4.0 python-dateutil==2.8.1 python-editor==1.0.4 pytz==2018.9 sh==1.13.1 simplejson==3.16.0 six==1.15.0 speaklater==1.3 SQLAlchemy==1.3.18 sqlparse==0.2.4 sshtunnel==0.1.5 virtualenv==20.0.23 Werkzeug==1.0.1 whitenoise==5.1.0 WTForms==2.2.1

matteius commented 2 years ago

Closing this issue as it was reported for much older versions of pipenv and I could not reproduce it with the examples given and the current version of pipenv; if you think there is still an issue related to this with 2022.1.8 and that it is not already covered in one of the existing (more recent) Issue reports, feel free to open a new issue with description following the template and provide a reproducible example that affects latest version. Thanks!

TurboCoder13 commented 2 years ago

I had a similar issue today with installing dependencies from a pipfile in my organisation. It may or may not be the exact same problem everyone had in this thread, but I figured it could be of some use to some of you. :)

pipfile contents:

[[source]]
name = "abc"
url = "nexus url"
verify_ssl = true

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
lxml = "*"
local_folder_1 = {extras = ["postgres"], version = "~=6.3.0"}
local_folder_2 = {editable = true, path = "path_1"}
pika = "*"
pyhamcrest = "*"
pylint = "*"
requests = "*"
zeep = "*"
aiohttp = "*"
psycopg2-binary = "*"

[requires]
python_version = "3.8"

When running pipenv install command from the dir where the pipfile was located, I was getting this error:

An error occurred while installing <requirement>

Then finally it shows this at the end:

Package installation failed...

My issue was a little more obvious though, since I had this output (shortened output):

[pipenv.exceptions.InstallError]: Collecting psycopg2-binary==2.9.3 [pipenv.exceptions.InstallError]: Error: pg_config executable not found.

So all I did was run pipenv install psycopg2-binary and then it installed psycopg2-binary as well as the packages in the pipfile.

remy-niles commented 1 year ago

I have found that this problem can also present itself if you made changes to your dependencies in your Pipfile but forgot to "lock" those changes to update the Pipfile.lock file accordingly (behaviour tested and observed in 2022.9.24, 2022.10.4, and 2022.10.25). In our specific situation, we had an internal package from an internal repo using PyPi as an upstream whose dependency declaration had been updated to a higher version in the Pipfile, but the lockfile (Pipfile.lock) still specified an older version. When running "pipenv sync" in our CI pipeline, whatever issue having this discrepancy caused prevented it from succeeding. Once we updated the lockfile accordingly and pushed the change, it resolved the issue. Hope it helps.

Aym3nTN commented 1 year ago

This stackoverflow response seems to solve the issue.. it did for me!

lwmonster commented 1 year ago
Installing mysqlclient...
⠧ Installing mysqlclient...[31m[1mError: [0m An error occurred while installing [32mmysqlclient[0m!
Error text: Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py): started
Building wheel for mysqlclient (setup.py): finished with status 'error'
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient: started
Running setup.py install for mysqlclient: finished with status 'error'

[36m error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
mysql_config --version
['8.0.32']
mysql_config --libs
['-L/usr/local/mysql/lib', '-lmysqlclient', '-lssl', '-lcrypto', '-lresolv']
mysql_config --cflags
['-I/usr/local/mysql/include']
ext_options:
library_dirs: ['/usr/local/mysql/lib']
libraries: ['mysqlclient', 'resolv']
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/usr/local/mysql/include']
extra_objects: []
define_macros: [('version_info', "(2,1,1,'final',0)"), ('version', '2.1.1')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-39
creating build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb
creating build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-universal2-cpython-39/MySQLdb/constants
warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building 'MySQLdb._mysql' extension
  creating build/temp.macosx-10.9-universal2-cpython-39
  creating build/temp.macosx-10.9-universal2-cpython-39/MySQLdb
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders
-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration
-Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/usr/local/mysql/include -I/Users/ppdady/.local/share/virtualenvs/django-projects-sx1FCRrR/include
-I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-universal2-cpython-39/MySQLdb/_mysql.o -std=c99
MySQLdb/_mysql.c:46:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
error: subprocess-exited-with-error

This works for me:

pipenv shell 

pip3 install --upgrade setuptools
Tlaloc-Es commented 1 year ago

The same here I tried to delete Pipfile.lock, upgrade pipenv and setuptools but nothing.

brf153 commented 1 year ago

Hey there, I was facing the same issue. I deleted the Pipfile and started installing all the packages again. This time when I was installing flask-sqlachemy I got the error

Resolving flask-sqlachemy...
Adding flask-sqlachemy to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock (81f117) out of date, updating to (7e9569)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
Resolving dependencies...
✘ Locking Failed!
⠸ Locking...
CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement flask-sqlachemy (from versions: none)
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/resolver.py", line 704, in _main
[ResolutionFailure]:       resolve_packages(
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/resolver.py", line 662, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/resolver.py", line 642, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/utils/resolver.py", line 1167, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/utils/resolver.py", line 948, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/lib/python3.10/dist-packages/pipenv/utils/resolver.py", line 690, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv run pip install <requirement_name> to bypass this mechanism, then run $ pipenv graph to inspect the versions actually installed in the virtualenv.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for flask-sqlachemy

Clearly, there is some mismatch in the version of the dependencies. So, I would recommend deleting the Pipfile and reinstalling the packages again. To be precise, I have Python version (3.10), pip version (22.0.2), and pipenv version 2023.7.23 .

nExmond commented 1 year ago

In my case, removing the extra Python version from my system, resetting the environment path, and reinstalling it fixed the problem.

Kotsuha commented 11 months ago

In my case, after running pipenv lock --clear I ran pipenv install and then it works.

SalahEddine03 commented 6 months ago

Hey Since you're seeing warnings about invalid metadata entries for the Click package, it's a good idea to try updating or reinstalling it. You can do this using pip: "pip install --upgrade click"