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 when running installed packages

See original GitHub issue

I am seeing this issue with lots of packages that have a command-line entry point (at least pytest and honcho):

$ pipenv --version
pipenv, version 3.2.0

$ pipenv install honcho
Installing honcho...
Collecting honcho
  Using cached honcho-0.7.1-py2.py3-none-any.whl
Installing collected packages: honcho
Successfully installed honcho-0.7.1

Adding honcho to Pipfile's [packages]...

$ pipenv run honcho
Traceback (most recent call last):
  File "<root>/.venv/bin/honcho", line 7, in <module>
    from honcho.command import main
ModuleNotFoundError: No module named 'honcho'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

5reactions
jacebrowningcommented, Jan 25, 2017

Weirdly, $ pipenv run python -m pytest does work.

3reactions
fnycommented, Mar 27, 2018

I’m having this exact same issue with a new package I’m working on… https://github.com/fny/thecurator/tree/pipenv-failure

The jsonschema package can’t be found in the tests even though it’s clearly installed in the virtualenv.

(thecurator-9LuGzVpd) bash-4.4 $ pipenv run pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
jsonschema (2.6.0)
pip (9.0.3)
pyaml (17.12.1)
PyYAML (3.12)
setuptools (39.0.1)
SQLAlchemy (1.2.5)
wheel (0.30.0)

(thecurator-9LuGzVpd) bash-4.4$ pipenv run pytest tests
================================================================================ test session starts ================================================================================
platform darwin -- Python 3.6.4, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: /Users/faraz/Workspace/thecurator, inifile:
collected 5 items / 1 errors

====================================================================================== ERRORS =======================================================================================
______________________________________________________________________ ERROR collecting tests/test_curation.py ______________________________________________________________________
ImportError while importing test module '/Users/faraz/Workspace/thecurator/tests/test_curation.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_curation.py:2: in <module>
    from thecurator.private import IS_PYPY, pypy_incompatible
thecurator/__init__.py:4: in <module>
    from .private.table_description import Registry
thecurator/private/table_description.py:6: in <module>
    import jsonschema
E   ModuleNotFoundError: No module named 'jsonschema'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: "ModuleNotFoundError", but module is installed?
Currently I run my code from PyCharm 2017.1.5 (windows 10) with Python interpreter set as Python 3.6.1 (C:\Anaconda3\python.exe) , i.e. I ...
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
How to fix the ModuleNotFoundError in Python · 1. Make sure imported modules are installed · 2. Make sure modules are spelled correctly...
Read more >
No module named ' ' in Python on Windows, Linux, and macOS
This video will show you how to fix ModuleNotFoundError : No module named ' ' when using importing packages or modules in Python....
Read more >
How to Fix ModuleNotFoundError (No Module Named) Error ...
in a virtual environment or using Python 2pip install numpy# 👇️ for python 3 (could also be pip3.10 depending on your version)pip3 install ......
Read more >
How to Fix ModuleNotFoundError and ImportError
first make sure you are using absolute imports · export the project's root directory to PYTHONPATH.
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