Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Why can't I use a library I just installed with Pip?
Post
Why can't I use a library I just installed with Pip?
I tried installing package-installation-test
[1] using Pip, and it appeared to be successful. But I can't use it as advertised, either by itself or by importing it from my code:
Failed attempts
$ pip install package-installation-test
Collecting package-installation-test
Using cached package_installation_test-1.0.0-py3-none-any.whl (3.1 kB)
Installing collected packages: package-installation-test
Successfully installed package-installation-test-1.0.0
$ demo-example-package
demo-example-package: command not found
$ python -m example_package
/path/to/python: No module named example_package
$ python -q
>>> import example_package
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'example_package'
>>>
Also, demo-example-package
doesn't tab-complete in my shell.
According to the documentation, I should get results like this instead:
Expected results
$ demo-example-package
Version 1.0.0 of example_package successfully installed.
The source code is in /path/to/example_package.
$ python -m example_package
Version 1.0.0 of example_package successfully installed.
The source code is in /path/to/example_package.
$ python -q
>>> import example_package # no error
>>> example_package.home()
PosixPath('/path/to/example_package')
Attempting to reinstall doesn't work either:
$ pip install package-installation-test
Requirement already satisfied: package-installation-test in /path/to/site-packages (1.0.0)
What gives?
-
Full disclosure: I am the author of this package. I created it specifically to demonstrate the problem for the purpose of a canonical Q&A. Whatever package you're actually trying to install and use, the fundamentally problem is still the same. ↩︎
1 comment thread