Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipenv graph fails: No module named 'pipenv' #2952

Closed
mmanhertz opened this issue Oct 9, 2018 · 18 comments
Closed

pipenv graph fails: No module named 'pipenv' #2952

mmanhertz opened this issue Oct 9, 2018 · 18 comments

Comments

@mmanhertz
Copy link

mmanhertz commented Oct 9, 2018

Issue description

With the newest version of pipenv (2018.10.9), pipenv graph fails with the error message ModuleNotFoundError: No module named 'pipenv'

Expected result

I expected pipenv graph to output the dependency graph of the venv.

Actual result

$ pipenv graph

ERROR:  Traceback (most recent call last):
  File "c:\\python27\\lib\\site-packages\\pipenv\\vendor\\pipdeptree.py", line 16, in <module>
    from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
ModuleNotFoundError: No module named 'pipenv'

Steps to replicate

  • Install version 2018.10.9 of pipenv.
  • Run pipenv graph

$ pipenv --support

Pipenv version: '2018.10.9'

Pipenv location: 'c:\\python27\\lib\\site-packages\\pipenv'

Python location: 'c:\\python27\\python.exe'

Python installations found:

  • 3.6.3: C:\Python36\python.exe
  • 2.7: C:\Python27\python.exe
  • 2.7: C:\Users\m.manhertz\.windows-build-tools\python27\python.exe
  • 2.7: C:\Users\m.manhertz\Envs\tpe\Scripts\python.exe
  • 3.7.0: C:\Python37\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.17134',
 'python_full_version': '2.7.12',
 'python_version': '2.7',
 'sys_platform': 'win32'}

System environment variables:

  • TMP
  • TPE_DB_PASSWORD
  • COMPUTERNAME
  • VS140COMNTOOLS
  • USERDOMAIN
  • TPE_DB_HOST
  • PSMODULEPATH
  • PYTHONDONTWRITEBYTECODE
  • COMMONPROGRAMFILES
  • PROCESSOR_IDENTIFIER
  • VBOX_MSI_INSTALL_PATH
  • PROGRAMFILES
  • PROCESSOR_REVISION
  • HOME
  • SYSTEMROOT
  • PROGRAMFILES(X86)
  • COMSPEC
  • DRIVERDATA
  • TERM
  • DJANGO_SETTINGS_MODULE
  • TEMP
  • ALLUSERSPROFILE
  • GITHUB_POSH_GIT
  • TVT
  • COMMONPROGRAMFILES(X86)
  • TPE_DB_NAME
  • PROCESSOR_ARCHITECTURE
  • PLINK_PROTOCOL
  • EDITOR
  • LOCALAPPDATA
  • GYP_MSVS_VERSION
  • HOMEPATH
  • USERDOMAIN_ROAMINGPROFILE
  • TPE_SECRET_KEY
  • ERLANG_HOME
  • USERNAME
  • WORKON_HOME
  • LOGONSERVER
  • SESSIONNAME
  • PROGRAMDATA
  • PYTHONPATH
  • ONEDRIVE
  • PATH
  • PIP_SHIMS_BASE_MODULE
  • TPE_DB_USER
  • AWE_DIR
  • PATHEXT
  • PIP_PYTHON_PATH
  • WINDIR
  • APPDATA
  • HOMEDRIVE
  • PROGRAMW6432
  • SYSTEMDRIVE
  • NUMBER_OF_PROCESSORS
  • USERDNSDOMAIN
  • PROCESSOR_LEVEL
  • VCTARGETSPATH
  • GETTEXTCLDRDIR
  • PYTHON_HOME
  • GITHUB_GIT
  • COMMONPROGRAMW6432
  • OS
  • PUBLIC
  • USERPROFILE

Pipenv???specific environment variables:

Debug???specific environment variables:

  • PATH: C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Python27\;C:\Python27\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Python27\;c:\Python27\Scripts;C:\Program Files\PostgreSQL\9.4\bin;C:\Program Files\PostgreSQL\9.4\lib;C:\Program Files\PostgreSQL\9.4\include;C:\Program Files\Redis\;C:\Program Files (x86)\PuTTY\;C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\Users\m.manhertz\AppData\Local\Microsoft\WindowsApps;C:\Users\m.manhertz\Documents\Tools;C:\Users\m.manhertz\AppData\Local\atom\bin;C:\Program Files\gettext-iconv\bin;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Users\m.manhertz\AppData\Local\Microsoft\WindowsApps;C:\Users\m.manhertz\AppData\Roaming\npm;C:\Python36\Scripts\;C:\Program Files\PostgreSQL\9.6\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;;C:\Users\m.manhertz\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\cmd;C:\Users\m.manhertz\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\usr\bin;C:\Users\m.manhertz\AppData\Local\GitHub\PortableGit_f02737a78695063deace08e96d5042710d3e32db\usr\share\git-tfs;C:\Users\m.manhertz\AppData\Local\GitHub\lfs-amd64_1.5.5;C:\Users\m.manhertz\AppData\Local\Apps\2.0\OOH24QXT.R8H\XWTJVPKY.DW1\gith..tion_317444273a93ac29_0003.0003_5794af8169eeff14;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;c:\python27\lib\site-packages\pywin32_system32
  • EDITOR: GitPad

Contents of Pipfile ('C:\Users\m.manhertz\Documents\GitHub\demo\Pipfile'):

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

[dev-packages]

[packages]

[requires]
python_version = "3.7"

Contents of Pipfile.lock ('C:\Users\m.manhertz\Documents\GitHub\demo\Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "7e7ef69da7248742e869378f8421880cf8f0017f96d94d086813baa518a65489"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}
@michael-k
Copy link

michael-k commented Oct 9, 2018

Same here with python 3.6 on linux; Running the import in a python3 shell works:

$ python3
Python 3.6.6 (default, Sep  5 2018, 03:40:52) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
>>> FrozenRequirement
<class 'pipenv.patched.notpip._internal.operations.freeze.FrozenRequirement'>
>>> get_installed_distributions
<function get_installed_distributions at 0x7f4298e859d8>
>>> import pipenv
>>> pipenv.__version__
'2018.10.9'

@wjv
Copy link
Contributor

wjv commented Oct 9, 2018

It appears that pipenv has transitioned from calling certain functions that are part of the pip API directory, to calling them via a shim which is installed as a submodule of pipenv.

I'm assuming that certain aspects of pipenv's functionality are actually run inside the project virtualenv, and that this includes pipenv graph.

The problem is that, whereas pip generally is installed in the project virtualenv, pipenv isn't, and hence these imports fail. If you do a pipenv run python and try to do the import, it'll fail.

A (nasty, temporary?) workaround is to install pipenv into the project virtualenv (i.e. pipenv install pipenv).

@tanuk1647
Copy link

Same here with python 3.6 on macOS.
pipenv==2018.5.18 seems to work correctly.

pipenv==2018.10.9

mymac:projectdir user$ pipenv graph

ERROR:  Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 16, in <module>
    from pipenv.vendor.pip_shims import get_installed_distributions, FrozenRequirement
ModuleNotFoundError: No module named 'pipenv'

pipenv==2018.7.1, 2018.6.25

mymac:projectdir user$ pipenv graph

ERROR:  Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 17, in <module>
    from pip._internal import get_installed_distributions
ImportError: cannot import name 'get_installed_distributions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/pipdeptree.py", line 20, in <module>
    from pip import get_installed_distributions, FrozenRequirement
ImportError: cannot import name 'get_installed_distributions'

pipenv==2018.5.18

mymac:projectdir user$ pipenv graph
appdirs==1.4.3
astropy==3.0.4
  - numpy [required: >=1.10.0, installed: 1.15.2]
(works correctly)

@alflanagan
Copy link

Note installing pipenv into the virtual environment (by adding to Pipfile) seems to be a workaround.

techalchemy added a commit that referenced this issue Oct 9, 2018
- Fixes #2952

Signed-off-by: Dan Ryan <dan@danryan.co>
weiji14 added a commit to weiji14/deepbedmap that referenced this issue Oct 10, 2018
Bump up pipenv version and also pinned python to version 3.6.6 for good measure. Took this pipenv upgrade as a chance to make installation friendlier by 1) adding in a diagram and 2) moving `pip install pipenv` to conda instead of doing it in the postBuild script. Also reinstate echo pipenv graph that was removed in 079ba79, bearing in mind this pypa/pipenv#2952.
@wjv
Copy link
Contributor

wjv commented Oct 10, 2018

Unfortunately the accepted pull request introduces a new problem. I’ve pointed it out in a comment #2975 but let me state it here too for completeness:

With this patch, pipenv graph shows me all the packages installed in the same location as pipenv, and not just the packages installed in the project virtualenv.

In other words: If pipenv is installed system-wide, pipenv graph shows me all the packages installed system-wide. If pipenv is installed using pip install --user, it shows me all the packages installed in my user space.

@hamidfzm
Copy link

Why this issue is closed? pipenv still facing the same problem

@grayguest
Copy link

Please ensure pip and pipenv version of all virtual environments are consistent with the normal environment,

python3 -m pip install --force-reinstall pip==18.0
python3 -m pip install --force-reinstall pipenv==2018.7.1 --user # --user means will setup in user's directory

@Jamim
Copy link
Contributor

Jamim commented Oct 12, 2018

Why this issue is closed? pipenv still facing the same problem

I believe there should be not delivered label or something like that.
@techalchemy, @kennethreitz What do you think?

@frostming
Copy link
Contributor

frostming commented Oct 12, 2018

Same issue here, take @grayguest 's suggestion until the fix is released.

Why this issue is closed? pipenv still facing the same problem

I believe there should be not delivered label or something like that.
@techalchemy, @kennethreitz What do you think?

I think we should keep the issue open.

@OrangeDog
Copy link
Contributor

Why this issue is closed? pipenv still facing the same problem

Also note that even though there is a merged commit, according to @wjv graph still doesn't work properly.

@justineyster
Copy link

I'm encountering this problem, as well. Any idea when a new release will be cut to fix this? I'm trying to resolve dependency mismatches and it's really hard without pipenv graph.

@daveio
Copy link

daveio commented Oct 13, 2018

+1, I'm still experiencing this issue.

@techalchemy
Copy link
Member

We don’t really have the manpower to manage flagging which merged fixes have been released by hand. I’ve asled the other maintainers for final changes but builds are passsing and I’m planning to release today. I’m out of town so on a limited schedule, should be in the next 2 hours

@tanuk1647
Copy link

tanuk1647 commented Oct 13, 2018

pipenv==2018.10.13 released about 4 hours ago. It seems to work correctly :)
The problem @wjv commented above seems to be solved.
I want to show respect to the maintainers for voluntary, hard work,
for providing such a useful, human familiar tool.

@daveio
Copy link

daveio commented Oct 14, 2018

Also confirming that this is fixed in pipenv==2018.10.13. Thanks so much, @tanuk1647 said it best.

@OlafSzmidt
Copy link

OlafSzmidt commented Oct 21, 2018

Confirming this on pipenv==2018.10.9. Will try 2018.10.13 now.

@hlongmore
Copy link

hlongmore commented Oct 24, 2018

I've been running into this problem on Windows 7 tonight, for any pipenv command, using PyCharm or using the command line. It appears that using 2018.10.13 fixes the issue (at least, after doing pip install --upgrade pipenv==2018.10.13, PyCharm finally started configuring the Pipenv environment; it's still going, but before it would error immediately).

Update: it finally finished, and added all the requirements from my project's Pipfile to the Pipenv environment in PyCharm.

@helping083
Copy link

Please ensure pip and pipenv version of all virtual environments are consistent with the normal environment,

python3 -m pip install --force-reinstall pipenv==2018.7.1 --user # --user means will setup in user's directory

this helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests