Reputation: 23
i've installed a python project, and it imports modules(Like almost every project). The problem is when i want to install them(because i haven't got the modules), for example: In the project is imported a module called "a" but when i go and install "a" with pip install a
, it says ERROR: Could not find a version that satisfies the requirement a (from versions: none) ERROR: No matching distribution found for a
. How could i know the name of the module that is imported in that python project?
Edit: btw i just found out the module that the project uses comes in the zip where the python project is. How could i install it so it works?
Upvotes: 0
Views: 395
Reputation: 12169
For installing from zip simply use:
pip install *.zip
or specify the path directly:
pip install <path to .zip>
pip install ./my-archive.zip
Same applies for a tarball or any other format. It can be even a folder. However, it has to include a proper setup.py
or other mechanism for pip to install it and pip has to support the packaging format (be it archive, networking protocol, version control system (git
prefix), etc).
pip install ./my-folder
pip install ./
pip install .
pip install ..
etc
If, however, there is no setup.py
present, you'll need to simply copy-paste the files somewhere where your project/module resides (or set PYTHONPATH
or sys.path
to that folder) to be able to import them. See this or this question for more.
Upvotes: 0
Reputation: 1314
All pip packages are listed here. If you want to import a module called a
inside a python script, the command to install it could be sometimes pip install b
. Because the name of the stored package can varied from the python import name. To find how to install it the best is to get the pypi url of your package. You can googling the python error ModuleNotFoundError: No module named 'dgvd'
, it always show you the pypi url in top links.
The good practice in a project is to have a txt file called requirement.txt that you create in bash using this command:
pip freeze > requirement.txt
Then install all packages in once using:
pip install -r requirement.txt
Upvotes: 1