When i try install requests give me this error - python

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aiohttp 3.8.3 requires charset-normalizer<3.0,>=2.0, but you have charset-normalizer 3.0.1 which is incompatible.
I trying to install requests

two packages have the same file name.
The easiest solution is to create a virtual environment for your project:
How to create a Virtual Environment?
Just run the below commands one by one:-
python -m venv .venv
.venv/scripts/activate
pip install request

Related

No Module named 'fastapi' - Ubuntu environment

Though I have pip and pip3 installed fastapi library in my Ubuntu based workstation, I get a weird error saying
No module named 'fastapi'.
I have been scratching my head since two days ago as the same code works in other laptop with same Ubuntu environment.
Uninstalled and reinstalled fastapi library
you're not using the correct environment to run your code.
Either, 1. install the package fast-api in the environment you running the code in or 2. switch to the other one the packages are installed in:
for 1:
sudo /bin/python3 -m pip install "fastapi[all]"
in this case you should be able to use the fast-api package
Note: the other packages you use are probably not installed as well
Maybe you are using the wrong env? It looks like you're using vscode so you can specify the interpeter
Try pip install --upgrade pip and then pip install fastapi again
Try using conda, and do conda install -c conda-forge fastapi

Inconsistent dependency errors result when installing via pip inside conda environments

I run the following code to install a package using pip (in this case from GitHub) on a server and on my local machine using Conda to handle my environments:
conda activate base
conda env remove --name test-phonetic
conda create --name test-phonetic python=3.8 -y &&
conda activate test-phonetic &&
python -m pip install --upgrade pip &&
# remember to set your GIT_TOKEN
python -m pip install -e git+https://${GIT_TOKEN}#github.com/username/phonetic-transcription.git#feature/transcriptor-class#egg=phonetic-transcription # from branch "feature/transcriptor-class"
I receive the following output from pip when running on the server:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jupyter-client 7.3.1 requires entrypoints, which is not installed.
jupyter-client 7.3.1 requires jupyter-core>=4.9.2, which is not installed.
jupyter-client 7.3.1 requires pyzmq>=22.3, which is not installed.
jupyter-client 7.3.1 requires tornado>=6.0, which is not installed.
jupyter-client 7.3.1 requires traitlets, which is not installed.
I receive no error message when installing on my local machine.
Another user receives the following output when installing on the server via the same commands (also using conda for environment management):
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bokeh 2.4.2 requires Jinja2>=2.9, which is not installed.
bokeh 2.4.2 requires numpy>=1.11.3, which is not installed.
bokeh 2.4.2 requires tornado>=5.1, which is not installed.
Why do we receive different "error" messages in each case given that Conda environments are theoretically distinct and do not see each other?
At first I thought Conda was using versions of packages from other environments (and thought to use the --copy flag to install all packages using copies instead of hard- or soft-linking which Conda presumably does across environments to save space) but indeed this is an option available with conda install, not pip install.
Why are the errors inconsistent when running the same code on different machines and how can I resolve these "errors"?
pip ERROR: pip's dependency resolver does not currently take into account all the packages that are installed has no answers and comments suggest using a clean environment to resolve the issue, but I have done this. Similar story for cannot resolve urllib3 version issue

Do Anaconda Cloud packages come with their dependencies?

Do Anaconda cloud packages manually pulled from their website come with all of the packages dependencies?
For example, I have package A that I need for a python project. It has a dependency tree like below:
pip show package_A
Name: package_A
Version: 1.0.1
Requires: package_X, package_Y
pip show package_X
Name: package_X
Version: 2.0.2
Requires:
pip show package_Y
Name:package_Y
Version: 3.0.3
Requires: package_M
pip show package_M
Name: package_M
Version: 4.0.4
Requires:
So if I wanted to manually pull down package_A from the anaconda cloud site, would I need to pull the *.tar.bz2 files for all packages or would the package_A-1.0.1-py36hafb9ca4_1.tar.bz2 file have all of the dependencies also?
I use pip to show the dependencies, but I will be using conda to install. SOmething like:
conda install /libs/package_A-1.0.1-py36hafb9ca4_1.tar.bz2
'conda install' command will resolve and install all dependencies automatically provided this was configured within the package. You can check package dependencies by running -
conda info package_A=1.0.1=py36hafb9ca4_1
However, if you you install directly from tarballs there is no dependency check. To install local packages you can use the option "--use-local"
conda install --use-local package_A=1.0.1=py36hafb9ca4_1

pip without SSL certificate checking?

is there an older version of pip that doesn't check SSL certificates?
my corporate proxy replaces the cert from pypi with a company one which causes pip to abort the install.
I can download the packages manually and use pip on the local .tar.gz files but that is just a pain particularly with complex dependencies.
Version 1.2.1 works great for me as I'm always behind a corporate proxy.
https://pypi.python.org/pypi/pip/1.2.1
I'm not sure of your situation, but I also had to install it on a shared VM so I built and installed it to my user directory (~/.local/)
python setup.py build
python setup.py install --user
Update your path (~/.bashrc)
export PATH=~/.local/bin:$PATH
Then install packages (fabric example)
pip install fabric --user

After installing Flask + gunicorn pip has unexpected dependencies

After creating a fresh folder and creating a virtual environment
$ virtualenv venv --distribute
And installing two packages
$ pip install Flask gunicorn
Then writing all of the current pip installed packages to a file
$ pip freeze > requirements.txt
$ cat requirements.txt
Flask==0.10.1
Jinja2==2.7
MarkupSafe==0.18
Werkzeug==0.9.1
distribute==0.6.34
gunicorn==17.5
itsdangerous==0.22
wsgiref==0.1.2
I get this longer than expected list of packages, who is responsible for them being installed and what are they used for? The package list in question:
wsgiref==0.1.2
itsdangerous==0.22
distribute==0.6.34
MarkupSafe==0.18
I've used pip mostly on my Ubuntu box, and didn't have these packages installed after identical commands, I've noticed this behaviour only on my mac.
wsgiref and distribute are always present in the virtualenv, even an "empty" one where you have not yet pip install'ed anything. See the accepted answer to my question Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages? for an explanation. Note this is a bug fixed in Python 3.3.
itsdangerous and MarkupSafe are relatively recent, new dependencies pulled in by newer Flask releases.
itsdangerous (docs) is required by Flask directly. Since version 0.10 - see the github commit which added this dependency.
MarkupSafe (docs) is required by Jinja2 which is required by Flask. Jinja2 added this dependency in its version 2.7 - see the github commit.
You say that these are not installed on your Ubuntu box after running identical commands. But what version of Flask and Jinja2 do you have there? If they are older than the versions on your Mac, that might explain why they didn't pull in these new dependencies.
it looks like those are Flask dependencies, (or dependencies of the flask dependencies)
pip install --no-install --verbose Flask
I was hoping pypi had a list of dependencies for each project, but I didn't see them...
Your virtualenv uses the packages installed system wide, so pip sees them along your newly installed ones.
Try adding the --no-site-packages option when creating your environment.
Or, try to explicitly run the pip instance installed in your environment
(path/to/your/env/bin/pip opts...), maybe this will tell pip to ignore system's packages (not sure about that one at all).

Categories

Resources