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.

ModuleNotFoundError inside Pipenv environment

See original GitHub issue

On Ubuntu I’m trying to install python packages inside Pipenv environment. I do start the Pipenv shell by typing pipenv shell and the pip install <package name> But, it is giving this error

ModuleNotFoundError: No module named ‘distutils.cmd

Pip is working fine with none Error like the above, outside Pipenv. The error is appearing only inside Pipenv.

I’m using python3.9.9

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frostmingcommented, Nov 27, 2021

It is working fine below python3.9.9, and I don’t have to install distutils manually.

It is not difficult to find it out. First make sure you can reproduce the bug

On below python3.9.9:

python -c "import distutils,sys;print(sys.path);print(distutils.__file__)"

See where distutils is from On python 3.9.9:

python -c "import distutils,sys;print(sys.path)"

See if sys.path doesn’t contain distutils package.

0reactions
matteiuscommented, Dec 19, 2021

I am compelled to close this issue for now given it appears to be an environment issue, which the original poster confirmed that in the Solution. Please note @Irfan-Ahmad-byte that including the output from pipenv --support would be helpful in future issue reports. It appears that the codebase (at least the vendor components) in pipenv depend on distutils being present. There should probably be a separate issue (maybe already is) to track dependence on distutils since:

Note: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Pipenv modules not found - Stack Overflow
I got an error from selenium about 'geckodriver' executable needing to be in PATH, but your solution fixed my problem. – bkula. Mar...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
☤ My pyenv-installed Python is not found​​ Make sure you have PYENV_ROOT set correctly. Pipenv only supports CPython distributions, with version name like...
Read more >
Libraries installed with pipenv, but ModuleNotFoundError ...
I am using pipenv v2021.5.29 to create an environment for running a script. I have a requirements.txt script with all the packages needed....
Read more >
No module named 'numpy'" windowsOS/pipenv shell - Python
Pipenv "ModuleNotFoundError: No module named 'numpy'" ... Then try within your pipenv environment, they should be different.
Read more >
A tool all Python developers should be using - Medium
Then do a pip install pipenv then pipenv install pandas --python 3.6 and within seconds you will have created a project with a...
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