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.
Post History
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 ...
#2: Post edited
- I tried installing [`package-installation-test`](https://pypi.org/project/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:
- ```bash
- $ 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:
- ```bash
- $ 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.
- I tried installing [`package-installation-test`](https://pypi.org/project/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:
- <details><summary>Failed attempts</summary>
- <section class="notice is-danger">
- ```bash
- $ 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'
- >>>
- ```
- </section></details>
- Also, `demo-example-package` doesn't tab-complete in my shell.
- According to the documentation, I should get results like this instead:
- <details><summary>Expected results</summary>
- <section class="notice is-success">
- ```bash
- $ 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')
- ```
- </section></details>
- Attempting to reinstall doesn't work either:
- <section class="notice is-warning">
- ```
- $ pip install package-installation-test
- Requirement already satisfied: package-installation-test in /path/to/site-packages (1.0.0)
- ```
- </section>
- 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.
#1: Initial revision
Why can't I use a library I just installed with Pip?
I tried installing [`package-installation-test`](https://pypi.org/project/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: ```bash $ 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: ```bash $ 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.