I installed a library "editable" with "pip install -e".
The library has updated the setup.py and new dependencies (install_requires=...) are required.
What should I do, to fetch the new dependencies?
I could install them manually. But an automatic resolve like on "pip install" would be nice.
Use the upgrade option:
$ pip install -h
...
-U, --upgrade Upgrade all packages to the newest available version
So: pip install -U editable
Related
I'm trying to update PIP (the Python package installer) so I can install a package in Python, but in order to do so, I need to use a PIP command. Essentially, I can't update PIP without having PIP been updated (i.e the command is python -m pip install --upgrade pip).
The error message is get is:
You are using pip version 9.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
In addition, the packages that I am attempting to install do not install.
I'm unsure how to get around this problem, and would greatly appreciate some help.
Just try it with administration privileges.
sudo python -m pip install --upgrade pip
*** If you are using windows run the command prompt as the administration
What's the difference between
pip install pkg_name and
pip install -U pkg_name?
Does it automatically install the dependencies too or something?
If we do pip install -h we see:
-U, --upgrade Upgrade all specified packages to the newest
available version.
So it upgrades the packages you specify (they can be already installed)
I have a requirement.txt file with the list of python package to install. One of the packages is psycopg2==2.6.2 I need to update this package to psycopg2==2.7. I tried to install by pip3 install psycopg2 But it doesn't affect requirement.txt file. Can you please point me in the right direction?
Notice that running pip3 install psycopg2 doesn't respect the requirements.txt file. To upgrade this package you need to use -U option:
pip3 install -U psycopg2
which is a shorthand for:
pip3 install --upgrade psycopg2
After that, you can update your requirements.txt with the following command:
pip freeze > requirements.txt
If you're looking for a solution to automatically update the requirements.txt file after you upgrade package/packages, you can use pip-upgrader.
Installation:
pip install pip-upgrader
Usage:
pip-upgrade
The above command auto-discovers the requirements file and prompts for selecting upgrades. You can also specify a path to the requirements file or/and specify a package to upgrade:
pip-upgrade /path/to/requirements.txt -p psycopg2
As you've discovered, pip doesn't update the requirements file. So the workflow you'd likely want to use is:
Update the version of psycopg2 in your requirements file from 2.6.2 to 2.7
Run pip install with the upgrade flag
pip3 install -U -r requirements.txt
If you're familiar with tools like npm that do update the version in the catalog file, you may be interested in using pipenv, which manages your dependencies and the virtual environment for you, much like npm does.
If you don't know the latest version of your package, then use pip to figure it out:
$ pip list --outdated | grep psycopg2
psycopg2 (2.7.3.2) - Latest: 2.7.4 [wheel]
you can try:
pip install --upgrade --force-reinstall -r requirements.txt
You can also ignore installed package and install the new one :
pip install --ignore-installed -r requirements.txt
Recently I delete some files related to python 2.7 and now I'm crazy. I want to use pip to install python package for current user rather global user.
➜ ~ where pip
/usr/local/bin/pip
➜ ~ pip -V
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
In the past, I can install requests easily by pip install requests. But now I have to sudo pip install requests or pip install --user requests.
I think because of pip's location I have to install python package within /Library/Python/2.7/..... As you see, it needs root permission. I know venv can help me but now I want to know how to intall python package for current user.
Use pip's --user option:
pip install --user package
According to pip's documentation:
--user
Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%Python on Windows. (See the Python documentation for site.USER_BASE for full details.)
Why can't I use
$ sudo pip install facebook-python-sdk
even with facebook-python-sdk package in pypi?
log: http://dpaste.com/hold/589044/
Not sure what's going on there, but you can use pip to install from the github repo:
pip install git+https://github.com/facebook/python-sdk.git\#egg=facebook-python-sdk
I usually use pip install -e which makes pip symlink the package for you, so you can edit the repo, update it etc, and get the latest changes without having to pip install again.