Connection Timing out while install p4python using pip - python

There seems to be a connection time out when trying to install p4python on a ubuntu system. I am trying install this using pip on an ubuntu install on a vm.
Here is the stack trace:
~$ pip install p4python
Downloading/unpacking p4python
Downloading p4python-2016.1.1415051.tar.gz (83kB): 83kB downloaded
Running setup.py (path:/tmp/pip-build-rsprca/p4python/setup.py) egg_info for package p4python
Attempting to load API from ftp.perforce.com
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-rsprca/p4python/setup.py", line 611, in <module>
p4_api_dir = get_api_dir()
File "/tmp/pip-build-rsprca/p4python/setup.py", line 532, in get_api_dir
p4ftp = P4APIFtp()
File "/tmp/pip-build-rsprca/p4python/setup.py", line 60, in __init__
self.ftp = FTP(PERFORCE_FTP)
File "/usr/lib/python2.7/ftplib.py", line 120, in __init__
self.connect(host)
File "/usr/lib/python2.7/ftplib.py", line 135, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 110] Connection timed out
Complete output from command python setup.py egg_info:
Attempting to load API from ftp.perforce.com
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-rsprca/p4python/setup.py", line 611, in <module>
p4_api_dir = get_api_dir()
File "/tmp/pip-build-rsprca/p4python/setup.py", line 532, in get_api_dir
p4ftp = P4APIFtp()
File "/tmp/pip-build-rsprca/p4python/setup.py", line 60, in __init__
self.ftp = FTP(PERFORCE_FTP)
File "/usr/lib/python2.7/ftplib.py", line 120, in __init__
self.connect(host)
File "/usr/lib/python2.7/ftplib.py", line 135, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 110] Connection timed out
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build- rsprca/p4python
Storing debug log for failure in /home/cicd/.pip/pip.log
Help with debugging this issue is appreciated.

Probably you have some firewall limitations (or using proxy).
Please use following command instead:
pip install p4python config --global http.sslVerify false --trusted-host pypi.org

Related

Installing GDAL for python in Google Cloud Functions -- error when deploying

I've been unsuccessful in using GDAL in a Google Cloud Function with Python 3.9. I've included gdal in the "requirements.txt" file:
numpy
pygrib
requests
google-cloud-storage
gdal
But get the following error when deploying the function:
Build failed: .../setuptools/command/egg_info.py", line 541, in run
self.add_defaults()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 578, in add_defaults
sdist.add_defaults(self)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 228, in add_defaults
self._add_defaults_ext()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/command/sdist.py", line 311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 255, in finalize_options
gdaldir = self.get_gdal_config('prefix')
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 194, in get_gdal_config
raise gdal_config_error(traceback_string + '\n' + msg)
__main__.gdal_config_error: Traceback (most recent call last):
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 87, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/layers/google.python.runtime/python/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/layers/google.python.runtime/python/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 188, in get_gdal_config
return fetch_config(option, gdal_config=self.gdal_config)
File "/tmp/pip-install-d9gag00y/gdal_e01a421a21914f03a3c89fd3914501b0/setup.py", line 90, in fetch_config
raise gdal_config_error(e)
gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.; Error ID: c84b3231
Reviewing other similar posts, e.g. GDAL package missing, it seems that the GDAL library/headers needs to be installed, sudo apt-get install libgdal-dev, before the pip install gdal will work. Given that I can't run apt-get for a cloud function, does anyone have a fix or workaround?
Posting this as a community wiki to help other community members that will encounter this issue:
GDAL Libraries is not supported by Google Cloud Function at the moment. However, you can use Cloud Run for special cases where you have full control over the container.

pip3 error : AttributeError: module 'platform' has no attribute 'linux_distribution'? (ubuntu 20.04 with python 3.8)

I think i have messed up some python files when installing some packages in a requirement.txt file
now i get these errors when trying to install or uninstall anything:
for example when trying to uninstall matplotlib without sudo using pip3 uninstall matplotlib (even tho i never had to use sudo to uninstall anything before) :
Found existing installation: matplotlib 3.3.1
Uninstalling matplotlib-3.3.1:
Would remove:
/usr/local/lib/python3.8/dist-packages/matplotlib-3.3.1-py3.8-linux-x86_64.egg
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 788, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/matplotlib-3.3.1-py3.8-linux-x86_64.egg' -> '/tmp/pip-uninstall-nw393b36'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 89, in run
uninstall_pathset = req.uninstall(
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 686, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
moved.stash(path)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 283, in stash
renames(path, new_path)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 352, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 800, in move
rmtree(src)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'pylab.py'
When trying with sudo :
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python3.8/dist-packages/pip/commands/uninstall.py", line 46, in run
with self._build_session(options) as session:
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 33, in <module>
sys.exit(load_entry_point('pip==20.3.dev0', 'console_scripts', 'pip3')())
File "/usr/local/lib/python3.8/dist-packages/pip/__init__.py", line 217, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 242, in main
with self._build_session(
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
How can i fix this? i am using ubuntu 20.04 and i heard uninstalling python3.8 is a big no no since many system files use it, so what should i do?
tried many suggestion on similar questions like this and it didn't work:
How to fix "module 'platform' has no attribute 'linux_distribution'" when installing new packages with Python3.8?
Python 3.8 removed some stuff. I solved my problems with pip (specifically pip install) by installing pip with curl
What worked for me was:
cd ~/Downloads
Downloading get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then running it with python 3.8:
python3.8 get-pip.py
Solved it for me.

pip install xmltodict not working

I am getting following error while installing xmltodict package for python.
pip install xmltodict
Downloading/unpacking xmltodict
Running setup.py egg_info for package xmltodict
Traceback (most recent call last):
File "", line 16, in
File "/tmp/pip-build-root/xmltodict/setup.py", line 36, in
setup_requires=['nose>=1.0', 'coverage'],
File "/usr/lib/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/pkg_resources.py", line 598, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (nose 0.10.4 (/usr/lib/python2.6/site-packages), Requirement.parse('nose>=1.0'))
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 16, in
File "/tmp/pip-build-root/xmltodict/setup.py", line 36, in
setup_requires=['nose>=1.0', 'coverage'],
File "/usr/lib/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/usr/lib/python2.6/site-packages/distribute-0.6.38-py2.6.egg/pkg_resources.py", line 598, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (nose 0.10.4 (/usr/lib/python2.6/site-packages), Requirement.parse('nose>=1.0'))
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/xmltodict
Storing complete log in /root/.pip/pip.log
try this
$ sudo yum install python-xmltodict
And also visit this github issue for more information

error on connection to redis-server in chat messenger

I have developed a chat system by Python. libraries been used :easygui,pycrypto,netifaces,stepic,redis,rabbitmq,pika,PIL and setuptools.
all libraries seems installed well refer to : python> import library
by using redis-server on localhost, users can connect to redis and signup,login,chat,.. but when setting redis on different device and change localhost to redis server ip in codes, i receive following errors. (am using lubuntu last version in oracle virtual machine)
enter code here
Traceback (most recent call last):
File "kiducb.py", line 392, in <module>
g = Gui()
File "kiducb.py", line 19, in __init__
self.welcome()
File "kiducb.py", line 33, in welcome
rl = self.login()
File "kiducb.py", line 126, in login
resp = self.check_up(fvals[0], fvals[1], mac)
File "kiducb.py", line 76, in check_up
val = self.re.get(username)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 423, in get
return self.execute_command('GET', name)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 283, in execute_command
connection.send_command(*args)
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 260, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 243, in
send_packed_command
self.connect()
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 191, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting 10.1.1.12:6379. Connection refused.
to solve this problem, i removed the redis-server which earlier i installed by useing apt-get from system, and i folowed this link instruction: https://www.digitalocean.com/community/articles/how-to-install-and-use-redis

why i failed to install django, should i run pip install for more times?

(py) D:\python>pip install django
Downloading/unpacking django
Downloading Django-1.4.1.tar.gz (7.7MB): 491kB downloaded
Exception:
Traceback (most recent call last):
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\basecommand.py",
line 107, in main
status = self.run(options, args)
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\commands\install.
py", line 256, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
e=self.bundle)
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\req.py", line 101
8, in prepare_files
self.unpack_url(url, location, self.is_download)
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\req.py", line 114
2, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_
dir)
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\download.py", lin
e 463, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "D:\python\py\lib\site-packages\pip-1.2.1-py2.7.egg\pip\download.py", lin
e 380, in _download_url
chunk = resp.read(4096)
File "C:\Python27\Lib\socket.py", line 378, in read
data = self._sock.recv(left)
File "C:\Python27\Lib\httplib.py", line 552, in read
s = self.fp.read(amt)
File "C:\Python27\Lib\socket.py", line 378, in read
data = self._sock.recv(left)
timeout: timed out
Storing complete log in C:\Users\bigmeow\pip\pip.log
where does pip store Django-1.4.1.tar.gz when it is downloaded?
Installation failed in download phase. You should answer the following questions:
Are you connected to the internet?
Are you using a proxy for internet connection? If you do, add a environment variable http_proxy=http://user:pass#my.site:port/

Categories

Resources