local pypi package depends on python pypi server - python

I created my local pypi server http://localhost:8080/simple. I uploaded packages flask-mongoengine I need for my project, but when tox try to do pip install that packages dependency for nose, it try to download from pypi.python.org
Collecting flask-mongoengine==0.9.2 (from -r requirements.txt (line 14))
Downloading https://localhost:8080/packages/flask-mongoengine-0.9.2.tar.gz (112kB)
100% |████████████████████████████████| 112kB 26.8MB/s
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/nose/: [Errno 101] Network is unreachable -- Some packages may not be found!
Couldn't find index page for 'nose' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno 101] Network is unreachable -- Some packages may not be found!
No local packages or working download links found for nose
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-n57wg0y0/flask-mongoengine/setup.py", line 74, in <module>
'Topic :: Software Development :: Libraries :: Python Modules'
File "/var/lib/jenkins/.pyenv/versions/3.5.2/lib/python3.5/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1134, in obtain
return installer(requirement)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('nose')
My pypi server has nose package, but some how, its not redirected to that.
Tried the first answer, it gives error
Traceback (most recent call last):
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/pip/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/var/lib/jenkins/workspace/myproject/.tox/py35/lib/python3.5/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'[global]'"
ERROR: InvocationError: '/var/lib/jenkins/workspace/myproject/.tox/py35/bin/pip install -i http://localhost:8080 --trusted-host localhost:8080 -r requirements.txt'

specify the default to point at localhost? in $HOME/.pypirc :
[distutils]
index-servers =
localpypi
[localpypi]
repository: http://localhost:8080/simple
username:<your_localpypi_username>
password:<your_localpypi_passwd>
A bit further up in requirements.txt something like this might instead work instead of .pypirc, or maybe it might be needed in addtion to:
# requirements.txt
--index-url http://localhost:8080/simple
--trusted-host localhost:8080
flask-mongoengine
And for $HOME/.config/pip/pip.conf :
[global]
timeout = 1
index-url = http://localhost:8080/simple
trusted-host = localhost:8080
ah yeah this too perhaps :
https://pypi.python.org/pypi/pypiserver#uploading-packages-remotely
also maybe :
python setup.py dist upload -r http://localhost:8080/simple
If any dependencies are required from pypi then :
PyPI local cache for Jenkins/local builds
how to create local own pypi repository index without mirror?
I get confused with all the places --index-url and --extra-index-url can get set, but the thought was to set the index-url for pypi, and for pip too?

Related

Pip Error Offline Installation from a Requirements.txt?

I'm trying to install Rasa (it's a python pip package) in a Ubuntu VM that has no internet connection. I use a requirements.txt to install rasa completely offline. The requirements.txt and the packages (.whl files) are in the same folder. I use following command:
pip install --no-index --find-links /home/...(folder with .whl files) -r requirements.txt
It collects the dependencies but stops after the "tensorflow" package. Here's the log:
(venv) [user#ubuntuvm alldependencies]$ pip install --no-index --find-links /home/user/alldependencies/ -r requirements.txt
Looking in links: /home/user/alldependencies/
Processing ./absl_py-0.10.0-py3-none-any.whl
[ PROCESSING bla bla....]
Processing ./tensorboard-2.3.0-py3-none-any.whl
Processing ./tensorboard_plugin_wit-1.7.0-py3-none-any.whl
Processing ./tensorflow-2.3.1-py3-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
return func(self, options, args)
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/commands/install.py", line 324, in run
reqs, check_supported_wheels=not options.target_dir
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 391, in _resolve_one
dist = abstract_dist.get_pkg_resources_distribution()
File "/home/user/venv/lib64/python3.6/site-packages/pip/_internal/distributions/wheel.py", line 29, in get_pkg_resources_distribution
with ZipFile(self.req.local_file_path, allowZip64=True) as z:
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/zipfile.py", line 1108, in __init__
self._RealGetContents()
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/zipfile.py", line 1175, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
What can I do? I installed Python 3.6 and the newest Pip Version (20.x).
Looks like the tensorflow-2.3.1-py3-none-any.whl is corrupted. Possible causes are: something went wrong during the download or during the write on disk of this file. Most likely downloading it again would solve the issue.

issue in installing packages using pip install

I need to install pyspark. It has a dependency on pypandoc. So I first do pip install pypandoc and then pip install pyspark and everything looks fine. However, based on some requirements I need to install my dependencies using a requirements.txt file. So I put both pypandoc and pyspark in the requirements.txt file and then I do pip install -r requirements.txt (pypandoc comes first in the file followed by pyspark), however this time the installation file with the following error
Complete output from command python setup.py egg_info:
Could not import pypandoc - required to package PySpark
Download error on https://pypi.org/simple/pypandoc/: [Errno 97] Address family not supported by protocol -- Some packages may not be found!
Couldn't find index page for 'pypandoc' (maybe misspelled?)
Download error on https://pypi.org/simple/: [Errno 97] Address family not supported by protocol -- Some packages may not be found!
No local packages or working download links found for pypandoc
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-6vmbjchu/pyspark/setup.py", line 224, in <module>
'Programming Language :: Python :: Implementation :: PyPy']
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 724, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 791, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pypandoc')
So it looks like when I do it in this way, the pypandoc is not properly installed when it tries to install pyspark. How can I fix this issue?

How to install virtualenvwrapper-win on windows 10 without internet access?

I need to install virtualenvwrapper-win on windows 10 . But that machine doesn't have access to internet. Is there anyway I can download and install it instead of pip install virtualenvwrapper ?
I already tried downloading virtualenvwrapper-4.8.4.tar.gz and
pip install /PATH/TO/FILE/virtualenvwrapper-4.8.4.tar.gz
But I get
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/pbr/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Couldn't find index page for 'pbr' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno 11001] getaddrinfofailed -- Some packages may not be found!
No local packages or working download links found for pbr
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\n2007107\AppData\Local\Temp\2\pip-_4e665tg-build\setup.py", line 7, in <module>
pbr=True,
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\setuptools\dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\setuptools\dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 1134, in obtain
return installer(requirement)
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\setuptools\dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "c:\users\n2007107\appdata\local\programs\python\python36\lib\site-packages\setuptools\command\easy_install.py", line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pbr')
On an Internet-connected host run
pip download virtualenvwrapper-win
pip downloads the package and all its dependencies. Move all downloaded files to the offline (non-connected) host and run
pip install --no-index --find-links=\path\to\downloads virtualenvwrapper-win
Replace \path\to\downloads with the path to the directory where you moved downloaded installation files.
But I don't see pbr as a dependency. If you still cannot install or run virtualenvwrapper-win scripts download and install pbr separately.

Unable to install twisted inside virtualenv on ubuntu 12.04

I am trying to install twisted inside virtualenv, everything seems to go fine but at the end this error is displayed.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-14YOyA/twisted/
The OS is ubuntu 12.04, does someone have any idea ?
here is the displayed text:
(solidwork)root#rico-TravelMate-5744Z:/home/rico# pip install twisted
Collecting twisted
/home/rico/solidwork/local/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/home/rico/solidwork/local/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Downloading Twisted-17.9.0.tar.bz2 (3.0MB)
100% |████████████████████████████████| 3.0MB 77kB/s
Complete output from command python setup.py egg_info:
Couldn't find index page for 'incremental' (maybe misspelled?)
No local packages or download links found for incremental>=16.10.1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-14YOyA/twisted/setup.py", line 21, in <module>
setuptools.setup(**_setup["getSetupArgs"]())
File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 576, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 821, in best_match
return self.obtain(req, installer) # try and download/install
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 833, in obtain
return installer(requirement)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 294, in fetch_build_egg
return cmd.easy_install(req)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 583, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-14YOyA/twisted/

Trying to install django-haystack

Hello I'm trying to install django-haystack on a Debian 7 x86 but it is impossible to install, this Debian is fresh installation, I compiled python 3.6, I am little disappointed, this the error I get
100% |ââââââââââââââââââââââââââââââââ| 389kB 9.0kB/s
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/setuptools_scm/: [Errno -2] Name or service not known -- Some packages may not be found!
Download error on https://pypi.python.org/simple/setuptools-scm/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'setuptools_scm' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found!
No local packages or working download links found for setuptools_scm
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-sc1wwqz8/django-haystack/setup.py", line 68, in <module>
setup_requires=['setuptools_scm'],
File "/usr/local/opt/python-3.6.1/lib/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/root/cubapk/lib/python3.6/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/root/cubapk/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/root/cubapk/lib/python3.6/site-packages/pkg_resources/__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/root/cubapk/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "/root/cubapk/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1134, in obtain
return installer(requirement)
File "/root/cubapk/lib/python3.6/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "/root/cubapk/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools_scm')
#RaminNietzsche, after few days I figured out the way out to fix this trouble, what did was to install by hand this setuptools_scm, I do not know why pip did not find any suitable distribution as the error message say.
What I did was this:
pip install setuptools_scm
Take another look at the OSError: Name or service not known.
This means your fresh install didn't have a proper resolver yet. Probably fixed itself a few days later, because you fixed your resolver.
In my case I was seeing the following error:
Could not find suitable distribution for Requirement.parse('setuptools_scm<4,>=3.2')
I tried to run pip install setuptools_scm but it didn't work as package was already installed.
What worked for me is installing the exact version setuptools_scm is asking.
pip install setuptools_scm==3.2

Categories