How to see what packages are required to install another package? [duplicate] - python

This question already has answers here:
List dependencies of Python wheel file
(7 answers)
Closed 3 years ago.
I want to install many packages on an offline computer, I download and install manually using the following code:
pip install XXXXX.whl --user
Although the code above does the offline installation, the package needs other packages so it tries to connect to the internet. I can see what package it is looking for. So, I will download manually and again install that. If there are a lot of packages required, it becomes overwhelming.
Any better solution? Can I know from the beginning that what packages have to be downloaded for installing my package?

Do you use anaconda?
Make a conda environment on your online pc and install all your packages you need.
Then check with
'''
conda list
'''
What packages you need.

Related

How to forward the library downloaded with pip? [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
installing python packages without internet and using source code as .tar.gz and .whl
(7 answers)
Closed 1 year ago.
I have two linux servers, one can be connected to the Internet, and the other can't. I downloaded some libraries using pip install library on a server that can be connected to the Internet, and I want to transfer it to another server. But how to set install paths? And how do I know which files are installed by pip? Or is there a better way to achieve this?
Thanks
I would utilize wheel in this case, which can make packages that you can bring to your offline machine. For example with numpy
pip wheel numpy
Collecting numpy
Downloading numpy-1.20.2-cp37-cp37m-win_amd64.whl (13.6 MB)
Saved c:\numpy-1.20.2-cp37-cp37m-win_amd64.whl
Then on your other machine copy these wheels and use pip
pip install numpy-1.20.2-cp37-cp37m-win_amd64.whl
You can do a similar thing with requirements.txt to gather a number of wheels at once.
I think the easiest thing to do would be to install the modules in a virtual environment, e.g. python3 -m venv .venv followed by your pip install <module> and then copy the entire .venv directory to the remote machine.
Cory Kramer suggests using wheels which a good alternative option too. Either method should work.

Produce a list of WHL files in the correct order for install offline [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 2 years ago.
I am building a standard virtual environment for a project that is not connected to the Internet. I therefore need to download all the wheel files and make an install script (CMD file). One thing that is a real pain is the process of figuring out dependencies so I install them in the right order. Is there something like pip freeze, but that lists the versions in the order they need to be installed?
Is there any reason you are not using a python packager?
If you still want to do it yourself you could just create a virtual environment, pip install -r requirements.txt and then zip the entire parent directory.
But there are issues here- if any of the requirements have compiled dependencies, they are not guaranteed to work on the hardware running the code in the end

How to install a Python package that does not exist in Anaconda Cloud [duplicate]

This question already has answers here:
How to install PyPi packages using anaconda conda command
(3 answers)
Closed 4 years ago.
I use Anaconda as the main source of python packages and also my main interpreter in PyCharm. If I want to install any package, I go to Anaconda Cloud and find it immediately something like this. Now, I want to install a package that only exists in Python Package Index here. I cannot find it in Anaconda Cloud so I don't know how to install it. Do I just need to include the package folder in the project directory in this case?
Thank you
You can install non-conda packages using pip:
pip install python-nonblock

How can I check the dependencies needed for installation of python package? [duplicate]

This question already has answers here:
How to find a Python package's dependencies
(11 answers)
Closed 5 years ago.
I want to check dependencies needed to install in order to install the python package in linux machine (centos ) without starting the installation of package .
I want to install Pysftp package in my machine but first I wanted to know dependencies I have to install in order to install Pyftp in machine .
could someone please provide the details we can list out all the dependencies needed.
I would install everything with anaconda (https://www.anaconda.com/download). Before installing a module with conda install ..., it first lists all the required updates very efficiently. It is then up to the user to proceed.

Install a python package in a virtual environment directly from git [duplicate]

This question already has answers here:
pip install from git repo branch
(8 answers)
Closed 5 years ago.
I have a python package I want to use, but it appears that the version installed through pip is seriously outdated, to the point where example code doesn't work. some research independently verified that in order to get the code to work properly, I need the latest version from git.
How do I install a python package from within a virtual environment directly from git without going through pip?
Alternatively, since I don't know too much about pip, if this should never be necessary, then how do I force pip to install the latest version on github?
You'll want to reference this documentation.
Here's the basic format:
pip install -e vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir
In the case of git it'd be something like
pip install -e git+https://www.github.com/name_your_project/name_your_repo

Categories