How can I install h5py with Portable Python v2.7? - python-2.7

I am doing some Python 2.7 development work on multiple computers, on some of which I do not have rights to install software. Thus, I am using Portable Python. One of the packages I need to use is h5py; however, since Portable Python installs without modifying the registry, the h5py installer doesn't see it as a valid Python installation. Also, simply extracting the h5py source to a custom F:\py\include folder and adding F:\py\include to the PYTHONPATH environment variable doesn't work, as import h5py results in an ImportError: Cannot import name _errors exception.
How do I install h5py with Portable Python 2.7?

Install Python 2.7 onto a computer for which you have sufficient administrative rights.
Install the appropriate version of h5py into this Python installation.
Find the h5py subfolder within the Python install (typically .\Lib\site-packages\h5py) and copy it to the F:\py\include folder mentioned (make sure to add F:\py\include to PYTHONPATH). See my answer here for more details.
Uninstall the 'official' version of Python, if desired.

Related

Dysfunctioning of pip in installing python packages on Windows

I am trying to install a Python module - pyproj-1.9.5.1-cp27-cp27m-win32.whl using the Python package installer - pip. Since I use a version of Python 2.7.10, which comes bundled with ArcGIS 10.4.1, it is already preloaded with pip, as all versions 2.7.9 onwards are. To install the module, I opened the Command Prompt in the directory of the module and typed
pip install pyproj-1.9.5.1-cp27-cp27m-win32
to get the error, which I have written below:
Could not find a version that satisfies the requirement pyproj-1.9.5.1-cp27-cp27m-win32 (from versions:) No matching distribution found for pyproj-1.9.5.1-cp27-cp27m-win32
Since ArcGIS 10.4 comes bundled with Python 2.7.10, it is pre-installed with pip. Pip is a recursive acronym that stands for "pip installs packages" and is a package management system that is used to install software packages written in Python, which is pre-installed in Python version 2.7.9+. Therefore, to install pyproj, make sure that %PYTHON_HOME%\Scripts\ and C:\Python27\ArcGIS10.4 are added in the Path of Environmental Variables in System Properties. After that, run Command Prompt as an administrator and type pip install pyproj to install pyproj.

How to install difflib module in python 2.7 windows 10

Currently, I am facing difficulty installing difflib module in python 2.7 version in windows 10 system.
I want it to perform some text analytics analysis
tried using
apt-get install npm
npm install difflib
and
pip.exe install difflib
Solution for me was to save the difflib.py in the location where your .py file resides and then import it in your file.
install using pip should be a great idea, You can refer to the module related details here:
https://docs.python.org/2.7/library/difflib.html
If you face an issue installing it using pip, then the next way is to get the difflib.py from any working machine and keep it in the project directory itself, so that just importing the module itself will work.
This is the codebase reference from svn of python itself:
https://svn.python.org/projects/python/trunk/Lib/difflib.py

Is it possible to install a django package without pip?

I am trying to install django-dash to run one of the dashboard examples and see what it's like.
I am on Windows running Python 2.7 and Django 1.6.5. I know the usual approach is to download pip then install the package using pip. However, I am on a work computer with no administrative rights so I can't access my Internet Option Settings to find my proxy URL to follow the instructions below:
Proxy problems
If you work in an office, you might be behind a HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password#proxy_url:port
I had the same issue when trying to install Django but was able to get it to work by moving the django directory under Python27/Lib/site-packages. Is there something similar I can do with django-dash?
I also tried downloading the sources and running python setup.py install. I received the following error:
File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools
Link to django-dash: http://django-dash.readthedocs.org/en/latest/
Yes, you can probably get the sources from The Python Package Index
Once you have them, uncompress the files and install them manually (this will depend on you OS).
On Linux systems:
python setup.py build
python setup.py install
Here's the full reference
EDIT : Note that when manually installing those packages, you must also install any missing dependencies, eg. setuptools in your case

Anaconda dependencies

I recently installed ipython, and along with it, anaconda. However, anaconda changed my sys.path directories, and some of the packages I was using before stopped working. Even after uninstalling anaconda using pip, it seems that those directories remained. How do I change them back? When I enter the python shell, I do and see the following:
Anaconda installs its own Python. When you run that Python, it uses the Anaconda Python libraries. The Anaconda installer put a line in your .profile that makes it first in the PATH, so that when you type python, it loads the Anaconda Python.
If you want to use the Python packages that you had installed into another Python with Anaconda, you will need to install them, using conda (or pip if they are not available via conda)
Anaconda is a separate python environment and as such doesn't have access to anything you installed in the base python environment. Depending on the project is usually a good idea to have separate environments using virtualenv or a similar tool. You can also do this using Anconda as described below.
Create a virtual environment for your project
conda create -n yourenvname python=x.x anaconda
Activate your virtual environment
source activate yourenvname
Install additional Python packages to a virtual environment.
conda install -n yourenvname [package]
Full description can be found at http://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

Installing EWSWrapper?

How to install ewswrapper for python off of their site on a windows, (sadly), 64 bit machine with python 2.7.
The Link to the site is here.
Thank you for your help.
The generally recommended way to install python packages is using a package manager like pip or (gasp) easy_install. However, there are a few exceptions like this one.
On Windows, there may be a pre-built package for you to download. In this case, the link is http://ewswrapper.lafiel.net/index.php?al3x_download=file&userid=PUBLIC&filepath=/PYTHON_Releases/_PYTHON_2012_02_09_EWSWrapper_v_0_2.7z.
You'll need to unzip the file with 7zip, and place the resulting directory in your site-packages path. You can locate your system's site-packages path by looking at this SO answer: How do I find the location of my Python site-packages directory?
Additionally, EWSWrapper will require a few dependencies that you should be able to get in pip.
pip.exe install python-ntlm suds
If you don't have pip, you can install it: How do I install pip on Windows?
Just so you know, this isn't the normal way a package is installed. Perhaps someone should let them know...