How to update a local package with pip [duplicate] - python

This question already has answers here:
How to update/upgrade a package using pip?
(9 answers)
Closed 3 years ago.
The answers here show how to install a local package using pip. However, I am also interested in knowing how to update a package. For example, if I previously had installed package with version 1.0.0, and now I want to replace it with 1.0.1, how would I do that? One method I can think of is to use pip uninstall and then install the new one, but is there a more elegant way?

I do the following to update a local python package:
Using -e flag tells pip install to read package in an editable mode, which means you don't need to reinstall the package after making your changes. They get detected automatically.
Using -U flag tells pip install to upgrade the package.
So, in your case, following should work:
pip install -e your_package_directory

Related

pip is not working in the vs code i tried changing the environment variables.. i'm stuck with this [duplicate]

This question already has answers here:
'pip' is not recognized as an internal or external command
(40 answers)
Closed 1 year ago.
pip not working with any followed commands:
pip is not showing anywhere:
It sounds like you may not have pip installed, judging from your pictures. If so type this to check python -m pip --version.
If you don't have it installed, perhaps try python -m pip install.
If you do have pip installed and are trying to install pygame, I suggest trying python -m pip install pygame.
I also found that using python didn't work but replacing it with py did. I did these things (a while ago) in terminal on a windows 10 machine, so my suggestions may not be relevant.

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

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.

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

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

Why does a virtualenv environment contain argparse, distribute and wsgiref? [duplicate]

This question already has answers here:
Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
(2 answers)
Closed 9 years ago.
I am using virtualenv version 1.7.1.2 with python 2.7.3 to create virtual python ennvironments. But when I create such an environment and activate it, I can see the following packages are installed (using pip freeze):
argparse==1.2.1
distribute==0.6.24
wsgiref==0.1.2
Why is that? What does that mean?
These are the standard packages, and will always follow with that version of Python and Virtualenv.
distribute is pretty self-explainatory. It's necessary for pip. Distribute also contains setuptools, but inside the package so not recognized with pip freeze. For more information about what it actually does check out your env/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg.
wsgiref is actually a part of the standard library, but isn't recognized as so. There's a bug report on it, and it's fixed in Python 3.3+. Read more about it in Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
I can't find out why argparse is there though, but my guess is because it's a dependency or something like wsgiref. Finding package dependencies in Python can be a bit hacky/painful though, especially if it's already installed in your virtualenv.

Categories