I try to build docker-compose from source with setuptools like this
python setup.py develop
But I get the follwoing error:
error: requests 2.11.1 is installed but requests!=2.18.0,>=2.14.2 is required by set(['docker'])
but running
pip show requests
gives the following result:
Name: requests
Version: 2.18.4
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me#kennethreitz.org
License: Apache 2.0
Location: /home/florian/.local/lib/python2.7/site-packages
Requires: certifi, chardet, idna, urllib3
Is there anything cached by setuptools or something similar?
try
sudo pip install --upgrade docker-compose
There was an issue in the git repo source code, that blocked me from building.
Related
I am trying to install a company-internal package "algo_flows".
pip show algo_flows shows it
(py37) noam#9cae2d848b93:~$ pip show algo_flows
Name: algo-flows
Version: 1.0.0.dev36
Summary: UNKNOWN
Home-page: UNKNOWN
Author:
Author-email:
License: UNKNOWN
Location: /home/noam/.local/lib/python3.7/site-packages
Requires: anomalib, datetime, fastapi, matplotlib, ml-distillery, numpy, opencv-python, overrides, pydantic, pytest, pytest-dependency, pytest-order, pyyaml, torch, torchvision, uv-python-utils
Required-by: inspection-manager
but it can't be imported, and is not shown via help("modules")
There is no way I can create a reproducible of this, I have no idea what could cause this.
How can I debug it? pip install seems to work fine!
I would like to use the requests module on python but I cannot use it even though I installed on my mac terminal with pip command.
Here is the result of pip show command.
(base) MacBook-Pro:~ *******$ pip show requests
Name: requests
Version: 2.24.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: **********
License: Apache 2.0
Location: /Users/*********/opt/anaconda3/lib/python3.8/site-packages
Requires: chardet, urllib3, idna, certifi
Required-by: Sphinx, jupyterlab-server, conda, conda-build, anaconda-project, anaconda-client
My Python code
import requests
from bs4 import BeautifulSoup
url = "https://ja.wikipedia.org/wiki/メインページ"
response= requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
today = soup.find("div", attrs={"id": "on_this_day"}).text
entries = today.find_all("li")
today_list = []
index = 1
for entry in entries:
today_list.append([index, entry.get_text()])
index += 1
print(today_list)
Error message
ModuleNotFoundError: No module named 'requests'
Environment
VS Studio
Macbook M1 2020
Could you please help? I have no idea what to do.
with
pip --vesrion
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
You can see that pip installs module for python3. And with
pip show requests
Name: requests
Version: 2.24.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: **********
License: Apache 2.0
Location: /Users/*********/opt/anaconda3/lib/python3.8/site-packages
shows that Requests is installed for python3. VS running python2 cannot find the module cause it is not installed for python2. You should set VS to use only python 3.8. You can test your script in a terminal running the command :
python3 ./path/to/script.py
To install requests for python2 (which I don't recommend using as it has passed it's end of life)
pip2 install requests
Finally, lookup virtual environment in python, it's a feature designed to separate each of your project and it's dependancy from other projects.
https://docs.python.org/3/library/venv.html
I am trying to understand an existing big python project which has lot of dependencies listed in requirement.txt. I like to understand what each libraries is meant for.
If there is a way to generate a short description given by them from pypi.org or other sources, that would greatly help.
For example:
#requirement.txt
gluonts
aiohttp
Expected outcome:
gluonts | GluonTS is a Python toolkit for probabilistic time series modeling
aiohttp | Async http client/server framework
Is there a tool (command line / online) that can provide descriptive insights on python dependencies ?
It is possible to get a description of packages installed using pip.
pip show [options] <package>
For example
pip show requests
Name: requests
Version: 2.25.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me#kennethreitz.org
License: Apache 2.0
Location: ..\programs\python\python38\lib\site-packages
Requires: urllib3, certifi, chardet, idna
Required-by:
You can use the summary field as a description. This of course relies upon the author having provided a sufficiently clear description.
You can do this inside a python script using the following
from pip._internal import main as pipmain
description = pipmain(['show','requests'])
If you have those packages installed you can use pip show <package-name>. For example:
$ pip show aiohttp
Name: aiohttp
Version: 3.7.3
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: Nikolay Kim
Author-email: fafhrd91#gmail.com
License: Apache 2
Location: /home/jack/repo/global-search-ingestion/global_search_lib/.venv/lib/python3.8/site-packages
Requires: typing-extensions, yarl, async-timeout, chardet, attrs, multidict
Required-by: faust, aiohttp-cors
To run this over your requirements.txt, you can use cut and xargs
pip show $(cat requirements.txt | cut -d "=" -f 1 | xargs)
And this will list out metadata for each library in you requirements.txt.
I'm trying to use the ansible module github_release that use the python module github3.py.
The machine that I need run the playbook don't have permission to access the internet so I downloaded (pip download github3.py) then in other machine I inslated (pip install ./*.whl).
I'm sure that the python module is instaled:
$ pip show github3.py
Name: github3.py
Version: 1.3.0
Summary: Python wrapper for the GitHub API(http://developer.github.com/v3)
Home-page: https://github3.readthedocs.io
Author: Ian Stapleton Cordasco
Author-email: graffatcolmingov#gmail.com
License: 3-clause BSD
Location: /usr/lib/python2.7/site-packages
Requires: python-dateutil, uritemplate, requests, jwcrypto
Required-by:
But my playbook have the same error:
TASK [Get latest release from repository] ***********************************************************************************************************************
fatal: [vg1200yr.dc.sedc.internal.vodafone.com]: FAILED! => {"changed": false, "msg": "Missing required github3 module (check docs or install with: pip install github3.py==1.0.0a4)"}
Any idea why my playbook can find the github3 module?
I am using Paramiko. Any idea how I can use the Paramiko.RSAKey.from_private_key() function?
I'm interested in using a function to parse a private key and use that private key for SSHClient.
Code I wanted to run:
file = './file.pem'
mypkey = paramiko.RSAKey.from_private_key_file(file)
Result:
ImportError: The version of cryptography does not match the loaded shared object. This can happen if you have multiple copies of cryptography installed in your Python path. Please try creating a new virtual environment to resolve this issue. Loaded python version: 2.4.2, shared object version: b'2.7'
It apears to be a problem with the lib cryptography:
from cryptography.hazmat.backends.openssl.backend import backend
I have python 3.7.1
I have installed Paramiko using pip install
Here are some infromation about the version I have used for paramiko :
pip show paramiko
Name: paramiko
Version: 2.6.0
Summary: SSH2 protocol library
Home-page: https://github.com/paramiko/paramiko/
License: LGPL
Requires: pynacl, bcrypt, cryptography
Required-by: sshtunnel
Here are some infromation about the version I have used for cryptography:
pip show cryptography
Name: cryptography
Version: 2.7
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page: https://github.com/pyca/cryptography
License: BSD or Apache License, Version 2.0
Requires: six, asn1crypto, cffi
Required-by: service-identity, pyOpenSSL, paramiko
I have unistalled cryptography and installed the same ver of the paramiko:
pip install cryptography==2.6.0
The same ERROR stays
This problem is almost always caused by having multiple copies of cryptography installed simultaneously. This can happen if you've installed cryptography both with pip and your system's package manager. Try building a new virtualenv, installing your dependencies into that, and that should resolve the issue.