question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Something weird with pkg-resources

See original GitHub issue
Issue description

pkg-resources in pipenv graph on clean --three Pipenv. After locking and cleaning, pipenv graph raises ModuleNotFoundError

Steps to replicate
me@mypc:/tmp$ mkdir issue
me@mypc:/tmp$ cd issue
me@mypc:/tmp/issue$ pipenv --three
Creating a virtualenv for this project...
Pipfile: /tmp/issue/Pipfile
Using /usr/bin/python3 (3.6.5) to create virtualenv...
⠋Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/me/.local/share/virtualenvs/issue-rZoCsvrN/bin/python3
Also creating executable in /home/me/.local/share/virtualenvs/issue-rZoCsvrN/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Setting project for issue-rZoCsvrN to /tmp/issue

Virtualenv location: /home/me/.local/share/virtualenvs/issue-rZoCsvrN
Creating a Pipfile for this project...
me@mypc:/tmp/issue$ pipenv graph
pkg-resources==0.0.0

me@mypc:/tmp/issue$ cat Pipfile 
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.6"
me@mypc:/tmp/issue$ pipenv lock
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Updated Pipfile.lock (ca72e7)!
me@mypc:/tmp/issue$ pipenv clean
Uninstalling 'pkg-resources'...
me@mypc:/tmp/issue$ pipenv graph

ERROR:  Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pipdeptree.py", line 22, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

me@mypc:/tmp/issue$

$ pipenv --support

Pipenv version: '2018.7.1'

Pipenv location: '/usr/local/lib/python3.6/dist-packages/pipenv'

Python location: '/usr/bin/python3'

Other Python installations in PATH:

  • 2.7: /usr/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.6: /usr/bin/python3.6m

  • 3.6: /usr/bin/python3.6

  • 2.7.15: /usr/bin/python

  • 2.7.15: /usr/bin/python2

  • 3.6.5: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-24-generic',
 'platform_system': 'Linux',
 'platform_version': '#26-Ubuntu SMP Wed Jun 13 08:44:47 UTC 2018',
 'python_full_version': '3.6.5',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • CLUTTER_IM_MODULE
  • LS_COLORS
  • LC_MEASUREMENT
  • LESSCLOSE
  • LC_PAPER
  • LC_MONETARY
  • XDG_MENU_PREFIX
  • LANG
  • DISPLAY
  • GNOME_SHELL_SESSION_MODE
  • GPG_TTY
  • COLORTERM
  • DESKTOP_AUTOSTART_ID
  • USERNAME
  • XDG_VTNR
  • SSH_AUTH_SOCK
  • MANDATORY_PATH
  • LC_NAME
  • XDG_SESSION_ID
  • USER
  • DESKTOP_SESSION
  • QT4_IM_MODULE
  • TEXTDOMAINDIR
  • GNOME_TERMINAL_SCREEN
  • DEFAULTS_PATH
  • PWD
  • HOME
  • TEXTDOMAIN
  • SSH_AGENT_PID
  • QT_ACCESSIBILITY
  • XDG_SESSION_TYPE
  • XDG_DATA_DIRS
  • XDG_SESSION_DESKTOP
  • LC_ADDRESS
  • LC_NUMERIC
  • GTK_MODULES
  • PAPERSIZE
  • WINDOWPATH
  • VTE_VERSION
  • TERM
  • SHELL
  • QT_IM_MODULE
  • XMODIFIERS
  • IM_CONFIG_PHASE
  • XDG_CURRENT_DESKTOP
  • GPG_AGENT_INFO
  • GNOME_TERMINAL_SERVICE
  • XDG_SEAT
  • SHLVL
  • LANGUAGE
  • LC_TELEPHONE
  • GDMSESSION
  • GNOME_DESKTOP_SESSION_ID
  • LOGNAME
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • XAUTHORITY
  • XDG_CONFIG_DIRS
  • PATH
  • LC_IDENTIFICATION
  • SESSION_MANAGER
  • LESSOPEN
  • GTK_IM_MODULE
  • LC_TIME
  • _
  • OLDPWD
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/me/.local/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: /tmp/issue

Contents of Pipfile (‘/tmp/issue/Pipfile’):

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

[packages]

[dev-packages]

[requires]
python_version = "3.6"

Contents of Pipfile.lock (‘/tmp/issue/Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "415dfdcb118dd9bdfef17671cb7dcd78dbd69b6ae7d4f39e8b44e71d60ca72e7"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.6"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mvolfikcommented, Jul 13, 2018

Oh, it worked. Virtualenv 15.1.0 --> 16.0.0 and now pkg_resources not there, locking and cleaning doesn’t break it. SOLVED ✔️

1reaction
mvolfikcommented, Jul 13, 2018

@uranusjr what do you mean by try reinstalling your virtualenv? pip3 install --force-reinstall virtualenv or pipenv --rm && pipenv --three?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named pkg_resources - python
This error message is caused by a missing/broken Python setuptools package. Per Matt M.'s comment and setuptools issue #581, the bootstrap script referred...
Read more >
Add __init__.py files if using pkg_resources - Computer Wit
In this situation, if you run resource_exists("mod1.mod2", "some_data_file.txt") –where resource_exists is imported from pkg_resources — while ...
Read more >
[yocto] poky using native pkg_resources module
When python-setuptools is generated by Yocto, it is partly >>>> a class, ... There is something wrong with your build although I am...
Read more >
Pylama builds successfully but then complains about ...
I built pylama (https://github.com/klen/pylama) successfully, but when I try to run it I'm getting complaints about unmet dependencies. The ...
Read more >
700320 – =dev-util/meson-0.51.2 on cross-armv6j-unknown ...
... on cross-armv6j-unknown-linux-gnueabihf - meson: pkg_resources. ... so there's something wrong with python cross compile: the host is amd64, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found