Run a Python script on a host without Internet connection - python

I read all the proposed related questions but didn't find an answer to my case.
As for the title, I need to run a Python script (e.i. not an executable created with pyInstall) on a Windows VM that is not connected to the Internet. I can only download packages via browser.
Install Python is not a problem, but pip doesn't work, so I have the libraries issue.
Do you have any suggestions?

If you go to PyPi, where pip searches for packages, and find a package you are interested in, you can click on "Download Files" on the left panel. Using numpy as an example: https://pypi.org/project/numpy/#files
You can manually download the files that you want for each package and install them directly with pip. Keep in mind that the first couple of rounds will likely involve error messages telling you that there are missing dependencies. You will have to go back to PyPi and get those dependencies as well, until everything installs correctly.
You may want to check the following question for information regarding manual dependency management: How to extract dependencies from a PyPi package.

Related

How to download a full package dependency chain using conda?

I have a requirements file that describes the conda packages I need. These are required dependencies in a script I want to run. The script needs to run on a machine that is not connected to a network or internet. Therefore, I have decided to use download-only as explained here.
This is not working for me. When I choose just one dependency to download, I get an error. This is my command-line statement:
conda install --download-only grpcio=1.35.0
This is the error I get:
CondaExitZero: Package caches prepared. UnlinkLinkTransaction
cancelled with --download-only option
Apparently, the download-only is in this cases helps me to cancel the download.... That is not what I want. I want to download the full dependency chain in order to use it in an offline environment.
How do I do that?
Please file a bug report on the Conda repository, since this appears that it shouldn't be happening. I suspect the issue is that for download-only transactions, Conda still determines that a package might need to be removed in order to eventually install the requested package. That shouldn't be necessary, so I'd call that a bug.
In the meantime, either try creating a new environment and then using the --download-only flag with that environment activated. Alternatively, this answer shows how to download raw packages for a full solve, ignoring any existing package cache.

connecting python to Bloomberg

i am trying to connect my pycharm to my Bloomberg terminal. At my old company the infrastrcutre was already setup but not at this smaller company. I am using the link provided by bloomberg (https://www.bloomberg.com/professional/support/api-library/) but because of the security setup on my work pc I cannot pip install this (>> python -m pip install --index-url=https://bcms.bloomberg.com/pip/simple blpapi). Does anyone know how to
connect to bloomberg using baby steps
manually download these packages instead of pip install
where to save these packages to import them into the code
Thanks
Are you allowed to use virtualenv?
If you are you can just do:
virtualenv env
source env/bin/activate
pip install --index-url=https://bcms.bloomberg.com/pip/simple blpapi
That will then install it only to your local virtual environment.
If you're not, you also just open https://bcms.bloomberg.com/pip/simple/blpapi/ and download the libraries yourself, uncompress them, and put the files on the PYTHONPATH of your application.
I was interested in the question so thought I'd share what I found poking around.
Edit: Grab the wheel file from the site https://bcms.bloomberg.com/pip/simple/blpapi/ and try these ideas with help from this question: Install python wheel file without using pip
(Edit: the link was down when I looked, now it is up so grab the right one for your platform.)
Pycharm has a lot of tools to install things in a virtual env, if they block that at work, but let you install pycharm and python then things are a little messed up. Just sayin...
If you get into pycharm settings and go to project interpreter and then click add you can search bloomberg and there are 3 projects. You might see if those have any support. They do have email addresses you can contact the people. Those might be old and no good anymore or they might be better, who knows.
Hopefully these ideas give you a new lead somewhere.

Unable to install packages -- Pycharm -- Python.exec path not working

I am trying to install packages to use in a python program and am unable to install anything. Included below are screen shots showing the interpreter selected, the path of that interpreter, and the error message I receive. Please let me know what I am missing.
I've been looking around at other people's problems like this and nothing seems to fit my issue.
This kind of error seems like you do not have a stable connection to the pypi. The standard recommendation would be to "Make sure you are connected to the internet, Pycharm is allowed through the firewall and that your proxy (if you are behind one) allows access to this url address."
Now that is not very helpful so if this issue is happening over a single package, you can simply download the python wheel from the beautifulsoup's project page and install it manually by running pip install downloaded_whl_file.whl in the Pycharm's terminal (make sure that the environment is right!)
Lastly, you might be able to get around it by using a pip proxy through pip install beautifulsoup4 --proxy http://some-proxy.com
I hope that the above can help you get through your issue!

How to install request library for python27

I'm currently creating a project I'm python and I need to post to a http server.I tried using pip install requests but pip doesn't work on my computer.
Pls how do I get the request library because it is not present in my python default libraries. Please I need something like a link or a website
where I can download and successfully install request library for python27.Thanks
If you go to PyPI.org and look up a package there, it will have a bunch of "Navigation" and "Project Links" links on the left side.
Start with Homepage if present. In the case of Requests, "Homepage" will take you to documentation where, right at the top, there's a link that says "Release v2.18.4 (Installation)". Click on that, and it'll tell you how to download and install from source.
If you can't find that for some package, try "Download" next, which will hopefully have nice friendly download links.
Failing that, click on "Download files", and you should get a table containing at least one entry of type "Source", with a link to a source tarball (or zipfile).
If you've found directions to install from source, great. If not, unpack the archive and scan through it trying to find an INSTALL or README or other doc that tells you have to install it.
Most current packages with up-to-date documentation are going to tell you to install the source (maybe after a manual build step) with pip install . (with or without sudo). If you really can't use pip at all for some strange reason, usually you'll be OK doing this instead (again, with or without sudo):
python setup.py install
However, you will often need to manually download and install some prerequisites. Look for a requirements.txt file, and recursively download and install each thing on that list, then come back to this package.
Finally, at the end of all of this, you won't have any good record of what you installed, what versions you had, which packages were dependencies of other packages, etc. Upgrading to new versions, or migrating your environment to a different machine, will be a nightmare. And so on. All the stuff pip does for you, you don't get if you don't use pip. But if you really want to do it all manually, you can.

Python Manage Repositories Pycharm

I have recently had to re-download and install Python by using the Anaconda package. This was done because i was having issues installing a few packages and found sources saying it would be easier to simply do it using Anaconda.
I now have the issue that I am unable to upgrade or find new packages (which i used to be able to do, i think it gave the list of all Pypi packages) and am not sure which URL i need to enter in order for PyCharm to find all the packages that it used to. This is what i currently have in the Repositories, As you can see i have already added a few PyPi links, of which none have been successful:
Does anyone know what link needs to be entered here to be able to browse through all PyPi Packages or upgrade currently installed packages?
Under Project Interpreter, there is an Anaconda button. This is a toggle. Turning it off, allows you to use repositories like https://pypi.python.org/simple.
In my configuration i have :
https://pypi.python.org/simple
I've had the same problem after installing Anaconda because of a tkinter problem

Categories