Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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?

+2
−0

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?


  1. 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. ↩︎

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

TODO (1 comment)
TODO
Karl Knechtel‭ wrote 6 months ago

I never ended up writing a specific Q&A for this on Stack Overflow - nor did I add an answer to the existing canonical there. I should probably update the package, especially so that the README refers to this question instead of vaguely pointing at Stack Overflow ;)