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

Error - "ModuleNotFoundError: No module named 'pkg_resources'" #5349

Closed
lukebakken opened this issue Sep 9, 2022 · 7 comments · Fixed by #5350
Closed

Error - "ModuleNotFoundError: No module named 'pkg_resources'" #5349

lukebakken opened this issue Sep 9, 2022 · 7 comments · Fixed by #5350
Labels
triage Type: Possible Bug This issue describes a possible bug in pipenv.

Comments

@lukebakken
Copy link

lukebakken commented Sep 9, 2022

Issue description

Running pipenv commands such as pipenv update results in

Traceback (most recent call last):
  File "/home/lbakken/.asdf/installs/python/3.10.7/lib/python3.10/site-packages/pipenv/resolver.py", line 867, in <module>
    main()
  File "/home/lbakken/.asdf/installs/python/3.10.7/lib/python3.10/site-packages/pipenv/resolver.py", line 841, in main
    _patch_path(pipenv_site=parsed.pipenv_site)
  File "/home/lbakken/.asdf/installs/python/3.10.7/lib/python3.10/site-packages/pipenv/resolver.py", line 48, in _patch_path
    pipenv_dist, pipenv_path = find_site_path("pipenv", site_dir=pipenv_site)
  File "/home/lbakken/.asdf/installs/python/3.10.7/lib/python3.10/site-packages/pipenv/resolver.py", line 10, in find_site_path
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Expected result

No ModuleNotFoundError

Actual result

See above stacktrace.

Steps to replicate

This is on an Arch Linux system updated as of 2022-09-09. I'm using asdf to install the latest Python so I can be sure this isn't due to the Python packages that ship with Arch Linux (where I see the same issue)

asdf plugin add python
asdf install python latest
asdf global python latest
pip install --upgrade pip setuptools pipenv
git clone https://github.com/rabbitmq/rabbitmq-website.git
cd rabbitmq-website
pipenv update

$ pipenv --support

Pipenv version: '2022.9.8'

Pipenv location: '/home/lbakken/.asdf/installs/python/3.10.7/lib/python3.10/site-packages/pipenv'

Python location: '/home/lbakken/.asdf/installs/python/3.10.7/bin/python3.10'

OS Name: 'posix'

User pip version: '22.2.2'

user Python installations found:

  • 3.10.7: /home/lbakken/.asdf/installs/python/3.10.7/bin/python3
  • 3.10.7: /home/lbakken/.asdf/installs/python/3.10.7/bin/python
  • 3.10.7: /home/lbakken/.asdf/installs/python/3.10.7/bin/python3
  • 3.10.6: /usr/bin/python3
  • 3.10.6: /usr/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.15.65-1-lts',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Mon, 05 Sep 2022 15:40:39 +0000',
 'python_full_version': '3.10.7',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • PATH
  • SHELL
  • HISTCONTROL
  • HISTSIZE
  • GIT_PS1_SHOWUPSTREAM
  • DOTNET_ROOT
  • SSH_AUTH_SOCK
  • GIT_PS1_SHOWDIRTYSTATE
  • SSH_AGENT_PID
  • GPG_TTY
  • CLOUDSDK_PYTHON_ARGS
  • EDITOR
  • PWD
  • LOGNAME
  • XDG_SESSION_TYPE
  • MOTD_SHOWN
  • HOME
  • LANG
  • HISTFILE
  • CLOUDSDK_ROOT_DIR
  • ERL_AFLAGS
  • SSH_CONNECTION
  • DOCKER_BUILDKIT
  • DOTNET_BUNDLE_EXTRACT_BASE_DIR
  • CLOUDSDK_PYTHON
  • GIT_PS1_SHOWSTASHSTATE
  • XDG_SESSION_CLASS
  • TERM
  • ASDF_DIR
  • GOOGLE_CLOUD_SDK_HOME
  • USER
  • SHLVL
  • XDG_SESSION_ID
  • XDG_RUNTIME_DIR
  • SSH_CLIENT
  • HISTFILESIZE
  • DBUS_SESSION_BUS_ADDRESS
  • MAIL
  • SSH_TTY
  • GIT_PS1_SHOWUNTRACKEDFILES
  • OLDPWD
  • GOPATH
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/lbakken/.asdf/plugins/python/shims:/home/lbakken/.asdf/installs/python/3.10.7/bin:/home/lbakken/bin:/home/lbakken/.asdf/shims:/home/lbakken/.asdf/bin:/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/home/lbakken/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/lbakken/go/bin
  • SHELL: /bin/bash
  • EDITOR: vim
  • LANG: en_US.UTF-8
  • PWD: /home/lbakken/development/rabbitmq/rabbitmq-website

Contents of Pipfile ('/home/lbakken/development/rabbitmq/rabbitmq-website/Pipfile'):

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

[packages]
lxml = "*"
markdown = "*"

[dev-packages]

[scripts]
preview = 'python driver.py'

Contents of Pipfile.lock ('/home/lbakken/development/rabbitmq/rabbitmq-website/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "076e75a534bbd13b0fa3c15053b54965c90ce9e68e794344af5d29e275e78a49"
        },
        "pipfile-spec": 6,
        "requires": {},
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "lxml": {
            "hashes": [
                "sha256:04da965dfebb5dac2619cb90fcf93efdb35b3c6994fea58a157a834f2f94b318",
                "sha256:0538747a9d7827ce3e16a8fdd201a99e661c7dee3c96c885d8ecba3c35d1032c",
                "sha256:0645e934e940107e2fdbe7c5b6fb8ec6232444260752598bc4d09511bd056c0b",
                "sha256:079b68f197c796e42aa80b1f739f058dcee796dc725cc9a1be0cdb08fc45b000",
                "sha256:0f3f0059891d3254c7b5fb935330d6db38d6519ecd238ca4fce93c234b4a0f73",
                "sha256:10d2017f9150248563bb579cd0d07c61c58da85c922b780060dcc9a3aa9f432d",
                "sha256:1355755b62c28950f9ce123c7a41460ed9743c699905cbe664a5bcc5c9c7c7fb",
                "sha256:13c90064b224e10c14dcdf8086688d3f0e612db53766e7478d7754703295c7c8",
                "sha256:1423631e3d51008871299525b541413c9b6c6423593e89f9c4cfbe8460afc0a2",
                "sha256:1436cf0063bba7888e43f1ba8d58824f085410ea2025befe81150aceb123e345",
                "sha256:1a7c59c6ffd6ef5db362b798f350e24ab2cfa5700d53ac6681918f314a4d3b94",
                "sha256:1e1cf47774373777936c5aabad489fef7b1c087dcd1f426b621fda9dcc12994e",
                "sha256:206a51077773c6c5d2ce1991327cda719063a47adc02bd703c56a662cdb6c58b",
                "sha256:21fb3d24ab430fc538a96e9fbb9b150029914805d551deeac7d7822f64631dfc",
                "sha256:27e590352c76156f50f538dbcebd1925317a0f70540f7dc8c97d2931c595783a",
                "sha256:287605bede6bd36e930577c5925fcea17cb30453d96a7b4c63c14a257118dbb9",
                "sha256:2aaf6a0a6465d39b5ca69688fce82d20088c1838534982996ec46633dc7ad6cc",
                "sha256:32a73c53783becdb7eaf75a2a1525ea8e49379fb7248c3eeefb9412123536387",
                "sha256:41fb58868b816c202e8881fd0f179a4644ce6e7cbbb248ef0283a34b73ec73bb",
                "sha256:4780677767dd52b99f0af1f123bc2c22873d30b474aa0e2fc3fe5e02217687c7",
                "sha256:4878e667ebabe9b65e785ac8da4d48886fe81193a84bbe49f12acff8f7a383a4",
                "sha256:487c8e61d7acc50b8be82bda8c8d21d20e133c3cbf41bd8ad7eb1aaeb3f07c97",
                "sha256:4beea0f31491bc086991b97517b9683e5cfb369205dac0148ef685ac12a20a67",
                "sha256:4cfbe42c686f33944e12f45a27d25a492cc0e43e1dc1da5d6a87cbcaf2e95627",
                "sha256:4d5bae0a37af799207140652a700f21a85946f107a199bcb06720b13a4f1f0b7",
                "sha256:4e285b5f2bf321fc0857b491b5028c5f276ec0c873b985d58d7748ece1d770dd",
                "sha256:57e4d637258703d14171b54203fd6822fda218c6c2658a7d30816b10995f29f3",
                "sha256:5974895115737a74a00b321e339b9c3f45c20275d226398ae79ac008d908bff7",
                "sha256:5ef87fca280fb15342726bd5f980f6faf8b84a5287fcc2d4962ea8af88b35130",
                "sha256:603a464c2e67d8a546ddaa206d98e3246e5db05594b97db844c2f0a1af37cf5b",
                "sha256:6653071f4f9bac46fbc30f3c7838b0e9063ee335908c5d61fb7a4a86c8fd2036",
                "sha256:6ca2264f341dd81e41f3fffecec6e446aa2121e0b8d026fb5130e02de1402785",
                "sha256:6d279033bf614953c3fc4a0aa9ac33a21e8044ca72d4fa8b9273fe75359d5cca",
                "sha256:6d949f53ad4fc7cf02c44d6678e7ff05ec5f5552b235b9e136bd52e9bf730b91",
                "sha256:6daa662aba22ef3258934105be2dd9afa5bb45748f4f702a3b39a5bf53a1f4dc",
                "sha256:6eafc048ea3f1b3c136c71a86db393be36b5b3d9c87b1c25204e7d397cee9536",
                "sha256:830c88747dce8a3e7525defa68afd742b4580df6aa2fdd6f0855481e3994d391",
                "sha256:86e92728ef3fc842c50a5cb1d5ba2bc66db7da08a7af53fb3da79e202d1b2cd3",
                "sha256:8caf4d16b31961e964c62194ea3e26a0e9561cdf72eecb1781458b67ec83423d",
                "sha256:8d1a92d8e90b286d491e5626af53afef2ba04da33e82e30744795c71880eaa21",
                "sha256:8f0a4d179c9a941eb80c3a63cdb495e539e064f8054230844dcf2fcb812b71d3",
                "sha256:9232b09f5efee6a495a99ae6824881940d6447debe272ea400c02e3b68aad85d",
                "sha256:927a9dd016d6033bc12e0bf5dee1dde140235fc8d0d51099353c76081c03dc29",
                "sha256:93e414e3206779ef41e5ff2448067213febf260ba747fc65389a3ddaa3fb8715",
                "sha256:98cafc618614d72b02185ac583c6f7796202062c41d2eeecdf07820bad3295ed",
                "sha256:9c3a88d20e4fe4a2a4a84bf439a5ac9c9aba400b85244c63a1ab7088f85d9d25",
                "sha256:9f36de4cd0c262dd9927886cc2305aa3f2210db437aa4fed3fb4940b8bf4592c",
                "sha256:a60f90bba4c37962cbf210f0188ecca87daafdf60271f4c6948606e4dabf8785",
                "sha256:a614e4afed58c14254e67862456d212c4dcceebab2eaa44d627c2ca04bf86837",
                "sha256:ae06c1e4bc60ee076292e582a7512f304abdf6c70db59b56745cca1684f875a4",
                "sha256:b122a188cd292c4d2fcd78d04f863b789ef43aa129b233d7c9004de08693728b",
                "sha256:b570da8cd0012f4af9fa76a5635cd31f707473e65a5a335b186069d5c7121ff2",
                "sha256:bcaa1c495ce623966d9fc8a187da80082334236a2a1c7e141763ffaf7a405067",
                "sha256:bd34f6d1810d9354dc7e35158aa6cc33456be7706df4420819af6ed966e85448",
                "sha256:be9eb06489bc975c38706902cbc6888f39e946b81383abc2838d186f0e8b6a9d",
                "sha256:c4b2e0559b68455c085fb0f6178e9752c4be3bba104d6e881eb5573b399d1eb2",
                "sha256:c62e8dd9754b7debda0c5ba59d34509c4688f853588d75b53c3791983faa96fc",
                "sha256:c852b1530083a620cb0de5f3cd6826f19862bafeaf77586f1aef326e49d95f0c",
                "sha256:d9fc0bf3ff86c17348dfc5d322f627d78273eba545db865c3cd14b3f19e57fa5",
                "sha256:dad7b164905d3e534883281c050180afcf1e230c3d4a54e8038aa5cfcf312b84",
                "sha256:e5f66bdf0976ec667fc4594d2812a00b07ed14d1b44259d19a41ae3fff99f2b8",
                "sha256:e8f0c9d65da595cfe91713bc1222af9ecabd37971762cb830dea2fc3b3bb2acf",
                "sha256:edffbe3c510d8f4bf8640e02ca019e48a9b72357318383ca60e3330c23aaffc7",
                "sha256:eea5d6443b093e1545ad0210e6cf27f920482bfcf5c77cdc8596aec73523bb7e",
                "sha256:ef72013e20dd5ba86a8ae1aed7f56f31d3374189aa8b433e7b12ad182c0d2dfb",
                "sha256:f05251bbc2145349b8d0b77c0d4e5f3b228418807b1ee27cefb11f69ed3d233b",
                "sha256:f1be258c4d3dc609e654a1dc59d37b17d7fef05df912c01fc2e15eb43a9735f3",
                "sha256:f9ced82717c7ec65a67667bb05865ffe38af0e835cdd78728f1209c8fffe0cad",
                "sha256:fe17d10b97fdf58155f858606bddb4e037b805a60ae023c009f760d8361a4eb8",
                "sha256:fe749b052bb7233fe5d072fcb549221a8cb1a16725c47c37e42b0b9cb3ff2c3f"
            ],
            "index": "pypi",
            "version": "==4.9.1"
        },
        "markdown": {
            "hashes": [
                "sha256:cbb516f16218e643d8e0a95b309f77eb118cb138d39a4f27851e6a63581db874",
                "sha256:f5da449a6e1c989a4cea2631aa8ee67caa5a2ef855d551c88f9e309f4634c621"
            ],
            "index": "pypi",
            "version": "==3.3.7"
        }
    },
    "develop": {}
}
@matteius matteius added Type: Possible Bug This issue describes a possible bug in pipenv. triage labels Sep 10, 2022
@matteius
Copy link
Member

matteius commented Sep 10, 2022

@lukebakken I have made a branch that modernizes some of the patching going on and utilizes the internal pkg_resources provided by pip -- if you have a moment to give it a try I would be very curious if it solves your problem. It is linked to this issue report.

EDIT: Actually I pushed a couple more commits that broke some things, and so let me spend some more time on this.

@matteius
Copy link
Member

Also will depend on sarugaku/requirementslib#343

@lukebakken
Copy link
Author

so let me spend some more time on this

No rush! I'll keep an eye out here!

@matteius
Copy link
Member

If you want to try it @lukebakken -- I believe I got it working today with: #5350
Also it cleaned up a couple other issues we were having, so I am pretty excited about it.

@lukebakken
Copy link
Author

@matteius yessir, PR #5350 fixes the issue! Output from my linux env:

$ python -m pip install git+https://github.com/pypa/pipenv@issue-5349
Collecting git+https://github.com/pypa/pipenv@issue-5349
  Cloning https://github.com/pypa/pipenv (to revision issue-5349) to /tmp/pip-req-build-r7w8taoy
  Running command git clone --filter=blob:none --quiet https://github.com/pypa/pipenv /tmp/pip-req-build-r7w8taoy
  Running command git checkout -b issue-5349 --track origin/issue-5349
  Switched to a new branch 'issue-5349'
  branch 'issue-5349' set up to track 'origin/issue-5349'.
  Resolved https://github.com/pypa/pipenv to commit 55d6f5b66d580460b850c9dbb761e8fa144e13e5
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools>=36.2.1 in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from pipenv==2022.9.9.dev0) (65.3.0)
Requirement already satisfied: virtualenv in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from pipenv==2022.9.9.dev0) (20.16.5)
Requirement already satisfied: virtualenv-clone>=0.2.5 in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from pipenv==2022.9.9.dev0) (0.5.7)
Requirement already satisfied: certifi in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from pipenv==2022.9.9.dev0) (2022.6.15.1)
Requirement already satisfied: filelock<4,>=3.4.1 in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from virtualenv->pipenv==2022.9.9.dev0) (3.8.0)
Requirement already satisfied: platformdirs<3,>=2.4 in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from virtualenv->pipenv==2022.9.9.dev0) (2.5.2)
Requirement already satisfied: distlib<1,>=0.3.5 in ./.asdf/installs/python/3.10.7/lib/python3.10/site-packages (from virtualenv->pipenv==2022.9.9.dev0) (0.3.6)
Building wheels for collected packages: pipenv
  Building wheel for pipenv (pyproject.toml) ... done
  Created wheel for pipenv: filename=pipenv-2022.9.9.dev0-py2.py3-none-any.whl size=3305307 sha256=dd974aca25c4e354ffeac1554521481e6027c3a44bf9fe21bf7cd77dd1d34b81
  Stored in directory: /tmp/pip-ephem-wheel-cache-togiolha/wheels/e1/b8/8d/da1025a83b19047867851c98a66e4d2dfa4c3ad91a74b4f765
Successfully built pipenv
Installing collected packages: pipenv
  Attempting uninstall: pipenv
    Found existing installation: pipenv 2022.9.8
    Uninstalling pipenv-2022.9.8:
      Successfully uninstalled pipenv-2022.9.8
Successfully installed pipenv-2022.9.9.dev0

lbakken@shostakovich ~/development/rabbitmq/rabbitmq-website (live =)
$ pipenv update
Running $ pipenv lock then $ pipenv sync.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (e78a49)!
Installing dependencies from Pipfile.lock (e78a49)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
All dependencies are now up-to-date!

THANK YOU

@lukebakken
Copy link
Author

I'm happy to do additional testing, so just let me know what you'd like.

I also have a Windows 10 pro environment I use for RabbitMQ development, which includes Python dev as well.

@matteius
Copy link
Member

2022.9.20 is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Type: Possible Bug This issue describes a possible bug in pipenv.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants