Install python package using conda without internet - python

I am behind corporate firewall and want to install a python package from .bz2 file.
I verified my python version to be 3.6.5 and downloaded appropriate package from anaconda cloud
This is how i am installing the package
conda install path_to_.bz2file
The error I get
I saw several examples where there is mention of extracting and running the setup.py file. I didnt find any setup.py file after extraction. Maybe its related to pypi not sure.
I dont have any internet connection on this machine so have to look for offline installation options.
Any help is appreciated.

PyPI distributions usually come with a setup.py. Here are the steps to download offline.
Find the package you want to download on PyPI
Download the latest distribution to a local directory, should be a tar.gz (tarball) file.
Open Anaconda Prompt/Terminal
cd to the tar.gz parent folder
pip install (filename)
Sometimes a package will have dependencies that need to be installed online. In this case you will need to do the same with the dependency before you can successfuly run the setup.py

Related

Artifactory: Download and unzip zip file using pip install

I created a repository, on Artifactory, which includes a zip containing 2 folders.
https://artifactory.healthcareit.net:443/artifactory/pi-generic-local/paymentintegrity-airflow-lib-plugins/paymentintegrity-airflow-libs-plugins-202211031330.zip
Is there a way to download that zip and extract the directories during a pip install? Basically, the developer just runs a pip install and gets the directories where needed.
I'm not looking for something in the [scripts] section since installing these directories would be the only thing currently needed in the Pipfile (its a weird project). Is this possible?
You can abuse the install command in the setup.py to call any arbitrary code, such as a one that unzips the assets and install it at the right place. I have seen this being done to package c++ binaries using python pypi in a place I worked for. See Post-install script with Python setuptools for hints on how to override the install command.
As per my observations, you have created generic repo and trying to fetch the packages using pip install. I would recommend creating a PyPI repository in the Artifactory and then try fetching the packages. This will. help in creating the metadata which will maintain all the package versions in the repository.
If you have the packages in your local then push them in the PyPI local repo and when you resolve them from Artifactory it will automatically download for the pip install based on your requirement.
If your requirement is to zip up multiple packages and push the archive file to the Artifactory and want the Artifactory to unzip and give the dependeciense during the pip install - then this is not possible from the Artifactory side we need to use a Post-install script with Python setup tools as mentioned .

in virtualenv, pip installing locally from source fails

I am trying to install a library in a virtualenv instance with pip. The library version I want (wxPython 3.0.2)
is not available on PyPi; it is only available for download from SourceForge. Thus, I have the source tarball downloaded on my machine and I am trying to install it in such a way that it will play nicely with virtualenv.
(I am on a Windows computer, running Python 2.7.)
I have tried the following:
doing a direct install: pip install wxPython-src-3.0.2.0.tar.bz2
extracting the files from the tarball to wxPython-src-3.0.2.0, then installing from the extracted directory: pip install wxPython-src-3.0.2.0
extracting the files from the tarball, then navigating into the extracted folder to the nested wxPython directory, which holds the setup.py file, and then installing from there: pip install wxPython
The last attempt seems the most promising, but I get the following traceback:
Processing \wxpython-src-3.0.2.0\wxpython
Complete output from command python setup.py egg_info:
Setuptools must be installed to build an egg
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\__MY_USERNAME__\appdata\local\temp\pip-req-build-q0pxlt\
This is also strange, because it suggests I don't have setuptools even though I can run pip list and see version 40.6.3 installed.
Any help appreciated.
Why not install a precompiled version? There are a lot of .exe files at SF. You probably need wxPython3.0-win64-3.0.2.0-py27.exe.
Also take a look at Christoph Gohlke's collection.
If you still insist on installing from sources please bear in mind that wxPython 3 is so old it predates pip. Forget about pip.
First, you need to install wxWidgets as wxPython is just a Python wrapper for wxWidgets C++ library. Extract wxPython-src-3.0.2.0.tar.bz2 and follow instructions in wxPython-src-3.0.2.0/docs/msw/install.txt.
After compiling and installing wxWidgets compile wxPython. See wxPython-src-3.0.2.0/wxPython/docs/BUILD.txt.
My eventual solution was the easy way out: installing my package (wxPython) locally as #phd suggested, and opting for local package access via either virtualenv --system-site-packages env or deleting the "no-global-site-packages.txt" file in an existing environment folder.
Not what I expected to do, but it works so no complaints.

Can python packages be downloaded with dependencies when neither python and pip are available?

I'm in a situation, where I have internet access on a computer but do not have permisson to install anything and python is missing as well.
Python on the other hand is installed on another computer without internet access. Both are in separate networks but i can transfer files through a file server which is connected to each computer as a networkn drive.
My quesion is, if it is possible to download packages with all the dependencies without having python and pip installed, than transfer the file and finally install it.
I simply tried to install a downloaded package from the PyPi Website as a *.zip or *.tar.gz file using the cmd with
chdir \path\to\package\file
python setup.py install
Importing that package afterwards creates errors as the dependencies are missing.
It would be totally fine if I just download Anaconda as all needed packages are already included with the installation. But I would still have the same problem when I want to update the packages.

Python project installation without internet connection

I need to install a python project on a machine without internet connection. During the creation of the deb package I downloaded all python requirements with pip download and I putted them into the deb.
When installing the deb on the machine I get errors from python packages not being found and I discovered that packages creating problems are the ones specified into the field setup_requires of setup.py files of the included packages.
For example the PyJWT package has setup_requires=['pytest-runner'] but pytest-runner is not downloaded by pip download and during the installation this gives error.
My question are:
is there a way of having pip downloading all dependencies (also those on setup_requires fields)?
Is this the correct workflow for creating a deb that has to be installed offline?

how to install virtualenv and/or pip

Someone please tell me I'm not crazy, becuase I really feel like I am right now.
Ok so, I'm trying to setup a webapp with python and django using heroku, but I've hit quite an odd obstacle.
It wants me to setup a virtualenv using the command $ virtualenv venv --distribute, which is all well and good except:
yeh, so naturally I googled how to install virtualenv and I found this:
But, of course:
So I continued my search by trying to find out how to install pip and I found this:
Aaaaaaand that's when I completely lost my marbles because apparently you need to install pip to install virtualenv to install pip. (maybe not, but that's why I'm a noob and I need help).
But then I took another look at the vitualenv installation guide, and found that I could download it and install it manually, so I extracted all the files from the downloaded archive into my python33 folder and used setup.py install. And I got this:
So I changed the line in that file to except ValueError as e and I got another error from a different python file in that same folder so I reverted the change I made and decided that it probably was not a good idea to meddle with those scripts.
Please, any help at all to do with setting up a free server with python and django would be greatly appreciated. Furthermore, I am sorry if my question is stupid, or incorrectly tagged.
You are following install guides for linux. You should try to find an install guide for pip and virtualenv on windows. First install pip systemwide and then use pip to install virtualenv systemwide. Then start using virtual environments.
Start with How to install pip on W$ and Python and virtualenv on W$. An alternative is the Hitchhiker's guide to python.
Edit
As Ron Elliott states in the comments,
you'll need to point your path to C:\Python2x\Scripts or C:\Python3x\Scripts in order to pick
up easy_install and pip as well as any other script executables
installing to that directory.
But then I took another look at the vitualenv installation guide, and
found that I could download it and install it manually, so I extracted
all the files from the downloaded archive into my python33 folder and
used setup.py install.
You downloaded the package and run setup.py install in wrong folder, that's why it didn't work.
You should:
Download the archive virtualenv-1.10.tar.gz to a Downloads folder (or where ever you want)
Extract it, you will have a folder name virtualenv-1.10
Go to (cd) the extracted folder
Run command: python setup.py install
Anyway I would recommend installing setuptools and pip first, then you can install virtualenv from pip: pip install virtualenv.

Categories

Resources