pipenv: pip 18.1 causes "TypeError: 'module' object is not callable"
Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.
Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.
Make sure to mention your debugging experience if the documented solution failed.
Issue description
New version of pip breaks pipenv, exactly on this line https://github.com/pypa/pipenv/blob/51cbc2e2f76a7c60f879a608fd96e95faca35f2e/pipenv/vendor/pip_shims/shims.py#L101
Expected result
The _strip_extras
not be a module.
Actual result
...
File "/opt/myproj/.tox/py36/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 704, in from_line
line, extras = _strip_extras(line)
TypeError: 'module' object is not callable
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
Please run $ pipenv --support
, and paste the results here. Don’t put backticks (`
) around it! The output already contains Markdown formatting.
If you’re on macOS, run the following:
$ pipenv --support | pbcopy
If you’re on Windows, run the following:
> pipenv --support | clip
If you’re on Linux, run the following:
$ pipenv --support | xclip
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 74
- Comments: 56 (14 by maintainers)
Commits related to this issue
- Pin pip version to work around an issue in pipenv. See https://github.com/pypa/pipenv/issues/2924 for details — committed to fourdigits/mollie-api-python by deleted user 6 years ago
- Pin pip version to work around an issue in pipenv. See https://github.com/pypa/pipenv/issues/2924 for details — committed to fourdigits/mollie-api-python by deleted user 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- Hopefully fix bug with pipenv --> pip interaction pint pip to version 18.0 to avoid this issue https://github.com/pypa/pipenv/issues/2924 — committed to learningequality/studio by ivanistheone 6 years ago
- pin pip to 18.0 because of breaking changes with pipenv Further details can be found on github https://github.com/pypa/pipenv/issues/2924 — committed to marionebl/blueant_api by rgaertner 6 years ago
- Bugfix: Pipenv messed up https://github.com/pypa/pipenv/issues/2924#issuecomment-427351356 — committed to x10an14/overtime-calculator by x10an14 6 years ago
- Work-around for pipenv bug See https://github.com/pypa/pipenv/issues/2924#issuecomment-427351356 — committed to item4/yui by item4 6 years ago
- Work-around for pipenv bug See https://github.com/pypa/pipenv/issues/2924#issuecomment-427351356 — committed to item4/yui by item4 6 years ago
- Bugfix: Pipenv messed up https://github.com/pypa/pipenv/issues/2924#issuecomment-427351356 — committed to x10an14/overtime-calculator by x10an14 6 years ago
- Add workaround for pypa/pipenv#2924 — committed to prkumar/uplink by prkumar 6 years ago
- Add workaround for pypa/pipenv#2924 — committed to prkumar/uplink by prkumar 6 years ago
- fix pip bugs (https://github.com/pypa/pipenv/issues/2924) — committed to Oprax/docker-python by deleted user 6 years ago
- Add news fragments and final patch for all fixes - Fixes #2499 - Fixes #2529 - Fixes #2589 - Fixes #2666 - Fixes #2767 - Fixes #2785 - Fixes #2795 - Fixes #2801 - Fixes #2802 - Fixes #2824 - Fixes #2... — committed to pypa/pipenv by techalchemy 6 years ago
- Add news fragments and final patch for all fixes - Fixes #2499 - Fixes #2529 - Fixes #2589 - Fixes #2666 - Fixes #2767 - Fixes #2785 - Fixes #2795 - Fixes #2801 - Fixes #2802 - Fixes #2824 - Fixes #2... — committed to pypa/pipenv by techalchemy 6 years ago
- Replace pipenv with a simple requirements.txt Motivations: - we do not want to pin a single Python version like Pipenv usually does - constant issues like https://github.com/pypa/pipenv/issues/2924 — committed to vifon/ranger by vifon 6 years ago
- :green_heart::pushpin: Pin pip version to 18.0 to fix CI build Pip version 18.1 breaks CI build, so applying workaround in https://github.com/pypa/pipenv/issues/2924. Also have the postBuild script e... — committed to weiji14/deepbedmap by weiji14 6 years ago
Workaround for typical virtualenv setup:
@Froskekongen Please try to avoid non-constructive messages. We understand this is frustrating, but interrogation doesn’t help. If you feel we need to improve, consider offering help instead of shouting at the sideline. “We” (whoever you are referring to) are always short of resources, and would gladly use your help.
This is extremely aggravating. Can you please try to coordinate releases of
pip
andpipenv
?pip install pipenv pipenv run pip install pip==18.0 pipenv install
do not work for me any other solutions? okay, i solve this by using this command: python3 -m pip install pipenv==2018.5.18
As in all cases it’s a bit more complicated, we are using pip internals which is not a great practice, and as part of our slow process of splitting out pipenv’s rather complex code we’ve left a few loose ends where we aren’t gracefully handling the switch.
In addition there was a gap in the test coverage of our main compatibility library, which wasn’t building against pip’s master branch for whatever reason. You can see here that this is now corrected, we should capture any upstream issues before they become a problem. This is on a daily cron, so hopefully we will avoid this going forward.
We have an ongoing discussion about how to refactor some internals to avoid importing things directly from pip, and that will be the long term solution, but for now this will provide some short term security
18.0
did not work for me. So I tried the following:This uses latest
master
ofpipenv
and it worked 🎊And for Windows machines you can use the following workaround :
pipenv run python -m pip install -U pip==18.0
Hey guys, Silly question - why has this bug been closed? I see the workaround is either using pipenv from master or installing an older version of pip - is there going to be a fix released too?
Doesn’t pipenv have unittest to avoid these kinds of errors upon release?
@encukou This would have allowed to quicky release a fix on the current version of pipenv without having to update with all new (potentially breaking) features. Now we have a “every update might break, deal with it” mentality, so people freeze pip and pipenv to at least control when the update happen. With semver we can accept bugfixes while refusing major change pretty easily.
And please avoid personal attack.
I’m not a PyPA contributor, but I’d like to suggest, in general: Before offering solutions, please take the time to read the existing discussion to make sure you’re contributing something new. The discussion is, unfortunately, scattered all over the place and there’s quite a lot of it already – see links to the various issues and PRs above.
On second thought, I’m going to keep this open so people don’t open duplicates.
You can also fix this by setting the environment variable
PIP_SHIMS_BASE_MODULE=pipenv.patched.notpip
as a temporary workaround. I will cut a release of all of the involved libraries today including pipenv.semver would have helped a lot here…
True, but it still maybe a good idea to publish a bug fix release, since this is affecting a lot of folks.
@dci-aloughran Usually, issues are closed when the fix is merged in the master branch, not when a release is made. That’s the case here – the code is in, but a release on PyPI isn’t ready yet.
pip install --user pip==18.0 resolves it
I cannot get pipenv install to run to save my life right now. Here is what it shows me…Any suggestions? Help really appreciated!
vagrant@ubuntu-xenial:/vagrant/HW2/wolfit$ pipenv install Installing dependencies from Pipfile.lock (b9d8dc)… Traceback (most recent call last):▉▉▉▉ 0/48 — 00:00:00 File “/home/vagrant/.local/bin/pipenv”, line 11, in <module> sys.exit(cli()) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py”, line 722, in call return self.main(*args, **kwargs) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py”, line 697, in main rv = self.invoke(ctx) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py”, line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py”, line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py”, line 535, in invoke return callback(*args, **kwargs) File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/cli.py”, line 435, in install selective_upgrade=selective_upgrade, File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/core.py”, line 1943, in do_install pypi_mirror=pypi_mirror, File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/core.py”, line 1322, in do_init pypi_mirror=pypi_mirror, File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/core.py”, line 807, in do_install_dependencies pypi_mirror=pypi_mirror, File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/core.py”, line 1375, in pip_install package_name.split(‘–hash’)[0].split(‘–trusted-host’)[0] File “/home/vagrant/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py”, line 704, in from_line line, extras = _strip_extras(line) TypeError: ‘module’ object is not callable 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/48 — 00:00:00
Figured it out by typing this: $ pip install --user pip==18.0
I’m seeing this issue as well. @nealedj 's suggestion worked correctly, although if you’re working around this in a build environment that already has pipenv installed, you don’t need to re-install pipenv. Only lines 2 and 3 of his workaround are needed.
If you happen to be using
--system
, then you will need to downgrade your system/globalpip
to18.0
as well. I am new topipenv
as of today (what a tough day to get started!) and this was not immediately apparent to me.same issue
$ pipenv --support
Pipenv version:
'2018.7.1'
Pipenv location:
'/home/bweigel/.local/anaconda/lib/python3.6/site-packages/pipenv'
Python location:
'/home/bweigel/.local/anaconda/bin/python'
Other Python installations in
PATH
:2.7
:/usr/bin/python2.7
2.7
:/usr/bin/python2.7
3.4
:/home/bweigel/.local/bin/python3.4
3.4
:/home/bweigel/.local/bin/python3.4
3.6
:/home/bweigel/.local/anaconda/bin/python3.6m
3.6
:/home/bweigel/.local/anaconda/bin/python3.6
3.6
:/usr/bin/python3.6
3.6.3
:/home/bweigel/.local/anaconda/bin/python
3.6.3
:/home/bweigel/.pyenv/shims/python
2.7.15
:/usr/bin/python
2.7.15
:/usr/bin/python2
3.6.3
:/home/bweigel/.local/anaconda/bin/python3
3.6.3
:/home/bweigel/.pyenv/shims/python3
3.6.6
:/usr/bin/python3
PEP 508 Information:
System environment variables:
CLUTTER_IM_MODULE
LS_COLORS
LC_MEASUREMENT
LESSCLOSE
LC_PAPER
LC_MONETARY
TERMINATOR_UUID
XDG_MENU_PREFIX
HADOOP_HOME
LANG
DISPLAY
OLDPWD
__GIT_PROMPT_SHOW_UPSTREAM
GNOME_SHELL_SESSION_MODE
COLORTERM
DESKTOP_AUTOSTART_ID
USERNAME
PYENV_VIRTUALENV_INIT
JAVA_HOME
XDG_VTNR
GIO_LAUNCHED_DESKTOP_FILE_PID
SSH_AUTH_SOCK
MANDATORY_PATH
LC_NAME
XDG_SESSION_ID
USER
DESKTOP_SESSION
QT4_IM_MODULE
TEXTDOMAINDIR
DEFAULTS_PATH
PWD
HOME
__GIT_PROMPT_IGNORE_SUBMODULES
TEXTDOMAIN
__GIT_PROMPT_IGNORE_STASH
SSH_AGENT_PID
__GIT_PROMPT_SHOW_UNTRACKED_FILES
QT_ACCESSIBILITY
XDG_SESSION_TYPE
XDG_DATA_DIRS
TERMINATOR_DBUS_NAME
HADOOP_CONF_DIR
XDG_SESSION_DESKTOP
LC_ADDRESS
SPARK_HOME
LC_NUMERIC
GTK_MODULES
TERMINATOR_DBUS_PATH
__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT
WINDOWPATH
TERM
VTE_VERSION
SHELL
QT_IM_MODULE
XMODIFIERS
IM_CONFIG_PHASE
XDG_CURRENT_DESKTOP
GPG_AGENT_INFO
GIO_LAUNCHED_DESKTOP_FILE
SHLVL
PYENV_SHELL
XDG_SEAT
GIT_BRANCH
PYTHONPATH
LC_TELEPHONE
GDMSESSION
GNOME_DESKTOP_SESSION_ID
LOGNAME
DBUS_SESSION_BUS_ADDRESS
XDG_RUNTIME_DIR
XAUTHORITY
PYSPARK_PYTHON
XDG_CONFIG_DIRS
PATH
LC_IDENTIFICATION
SESSION_MANAGER
LESSOPEN
GTK_IM_MODULE
LC_TIME
_
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/home/bweigel/.local/anaconda/bin:/home/bweigel/.local/bin:/opt/spark/bin:/opt/spark/sbin:/opt/hadoop/bin:/opt/java/bin:/home/bweigel/.local/share/virtualenvs/:/home/bweigel/.pyenv/plugins/pyenv-virtualenv/shims:/home/bweigel/.pyenv/shims:/home/bweigel/.pyenv/bin:/opt/node/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
SHELL
:/bin/bash
LANG
:en_US.UTF-8
PWD
:/home/bweigel/Projects/Europace/europace-datalake-und-warehouse/redshift-connector/lambdas
Contents of
Pipfile
(‘/home/bweigel/Projects/Europace/europace-datalake-und-warehouse/redshift-connector/lambdas/Pipfile’):Contents of
Pipfile.lock
(‘/home/bweigel/Projects/Europace/europace-datalake-und-warehouse/redshift-connector/lambdas/Pipfile.lock’):Also @nealedj 's fix doesn't work for me... :frowning_face:Ok…maybe it does…I was running tox and and needed to add the line
pipenv run pip install pip==18.0
in thecommands
section:i tried work around, see down there i put pip --version and it shows 18.0 still didnt help, i re-installed python/pip/pipenv… all of them for nothing… still getting error, note: it worked before, suddenly today pipenv stopped working
C:\Users\PhilipAbed\Downloads\test\GithubProjects\whois-master-python>pipenv install django Installing django… Looking in indexes: https://pypi.python.org/simple Collecting django Downloading https://files.pythonhosted.org/packages/32/ab/22530cc1b2114e6067eece94a333d6c749fa1c56a009f0721e51c181ea53/Django-2.1.2-py3-none-any.whl (7.3MB) Collecting pytz (from django) Using cached https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl Installing collected packages: pytz, django Successfully installed django-2.1.2 pytz-2018.5
Adding django to Pipfile’s [packages]… Pipfile.lock (f6afc3) out of date, updating to (10a1c3)… Locking [dev-packages] dependencies… oaming\Python\Python37\site-packages\pipenv\utils.py", line 402, in resolve_deps req_dir=req_dir File “C:\Users\PhilipAbed\AppData\Roaming\Python\Python37\site-packages\pipenv\utils.py”, line 250, in actually_resolve_deps req = Requirement.from_line(dep) File “C:\Users\PhilipAbed\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py”, line 704, in from_line line, extras = _strip_extras(line) TypeError: ‘module’ object is not callable
C:\Users\PhilipAbed\Downloads\test\GithubProjects\whois-master-python>pip --version pip 18.0 from c:\users\philipabed\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)
C:\Users\PhilipAbed\Downloads\test\GithubProjects\whois-master-python>
Setting the environment variable
PIP_SHIMS_BASE_MODULE=pipenv.patched.notpip
didn’t work for me, butpipenv run pip install pip==18.0
does.Worked for me on Ubuntu
Following on as @skinitimski has said –
On Windows 10, even if I had the local pip in my working pipenv downgraded to 18.0 via
pipenv run pip install pip==18.0
, I still could not install dependencies for a project using pipenv because, it appears, I needed the system pip to be downgraded as well.For me, that was: