I'm attempting to install pip for arcpy (arcgis 10.2 on windows 7). Running get-pip.py results in the following error message:
X:\python>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20061, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "c:\temp\tmpou5fje\pip.zip\pip\__init__.py", line 26, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\utils\__init__.py", line 27, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\pkg_resources\__init__.py", line 73, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\packaging\specifiers.py", line 275, in <module>
File "c:\temp\tmpou5fje\pip.zip\pip\_vendor\packaging\specifiers.py", line 373, in Specifier
File "C:\Python27\ArcGIS10.2\Lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "C:\Python27\ArcGIS10.2\Lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Using an administrator command prompt doesn't help. My real goal is to get win32com working under arcpy. I usual just copy the appropriate directories out of c:\python27\lib\site-packages to c:\python27\arcgis10.2\lib\site-packages to install a package under arcpy (why doesn't arcpy come with pip?) but that's not working for win32com, presumably do to a missing dll or other windows specific file.
I would recommend the following:
Get the setuptools module
Get the pip module`
And then run the following in command line (assuming windows)
path-to-python path-to-setuptools install
path-to-python path-to-pip install
I work on a closed network (away from the interwebs of old) and cannot use get-pip.py so I find it best to simply download the actual modules and hard install.
Keep us posted!
Copy get_pip.py to "C:\Python27\ArcGIS10.2", then perform command "python get-pip.py" in the directory.
Note that keep network connected in the process, so that auto-download and setup setuptools,wheels,etc.
Hope that can help you.
Try opening a CMD prompt and typing:
C:\Python27\ArcGIS10.2\python.exe -m pip install -U pip
Related
I was trying to update python's pip command through the command line and accidentally pressed ctrl+c which cancelled the upgrade mid-process.
As soon as I realised what had happened I tried to rerun the command python -m install --upgrade pip and I got this error code:
(Currently running python 3.8.3) on Windows 10 Home
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\__main__.py", line 29, in <module>
from pip._internal.cli.main import main as _main
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 21, in <module>
from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor'
Is there any way to fix this or should I reinstall python? I had no extra pip libraries installed except the requests library.
You can follow this guide. I also describe the steps here:
Find where your python is located. In Windows it might be located in a path similar to C:\Users\<your-name>\AppsData\Local\Programs\Python\Python38-<minor-version>
Download the get-pip.py script to the directory where your Python is located. You can just copy the content and paste it into a file with the same name
Open the terminal (or PowerShell) and change the directory to where your Python is located.
run the script as follows: python get-pip.py
Verify the installation by executing: pip -V
I have coded a mathematical model and want to solve it using DOCPLEX module. My interpreter is Python 3.7. However, after doing a lot of effort, I will face the following error:
Traceback (most recent call last):
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 290, in get_cplex_module
import cplex ##UnresolvedImport
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\__init__.py", line 44, in <module>
from .aborter import Aborter
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\aborter.py", line 13, in <module>
from ._internal import _procedural as _proc
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\_internal\__init__.py", line 20, in <module>
from . import _list_array_utils
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\_internal\_list_array_utils.py", line 14, in <module>
from . import _pycplex as CPX
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\_internal\_pycplex.py", line 13, in <module>
from . import _pycplex_platform
File "C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.8\x64_win64\cplex\_internal\_pycplex_platform.py", line 22, in <module>
from cplex._internal.py37_cplex2010 import *
ModuleNotFoundError: No module named 'cplex._internal.py37_cplex2010'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/xxx/PycharmProjects/pythonProject/EPC _LTC.py", line 11, in <module>
mdl = Model("LTC")
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\model.py", line 398, in __init__
self._environment = self._make_environment()
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\model.py", line 174, in _make_environment
env = Environment.get_default_env()
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 427, in get_default_env
Environment._default_env = Environment.make_new_configured_env()
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 422, in make_new_configured_env
return Environment(start_auto_configure=True)
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 84, in __init__
self.auto_configure(logger=logger)
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 220, in auto_configure
self.check_cplex(logger=logger)
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 328, in check_cplex
cplex = self.get_cplex_module(logger=logger)
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 314, in get_cplex_module
cplex = load_cplex_from_cos_root(loc) if loc else None
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 286, in load_cplex_from_cos_root
return load_cplex(full_path, version=version)
File "C:\Users\xxx\PycharmProjects\pythonProject\venv\lib\site-packages\docplex\mp\environment.py", line 261, in load_cplex
raise FileNotFoundError("Could not load module from %s" % module_location)
FileNotFoundError: Could not load module from C:\Program Files\IBM\ILOG\CPLEX_Studio201;C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.7\x64_win64;C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python\3.7\x64_win64\cplex;\cplex\python\3.7\x64_win64\cplex\__init__.py
I have already run the following codes in my Pycharm's terminal:
cd C:\Program Files\IBM\ILOG\CPLEX_Studio201\python
python setup.py install
or
cd C:\Program Files\IBM\ILOG\CPLEX_Studio201\python
python setup.py install --home C:\Users\xxx\PycharmProjects\pythonProject\venv\Lib\site-packages\cplex
Finally, I also set the path variables of my own username to something like below:
"C:\Program Files\IBM\ILOG\CPLEX_Studio129\cplex\python\3.6\x64_win64" and
"C:\Program Files\IBM\ILOG\CPLEX_Studio129\cplex\bin\x64_win64\cplex.exe"
In my case I upgraded to python 3.8 and solved the issue
or you can use this:
pip install docplex==2.15.194
The problem is that python setup.py install does not guaranty that the python interpreter you are using is the same as your virtual env.
You need to activate your env before you run the install script.
Please open a Terminal then run:
C:\Users\xxx\PycharmProjects\pythonProject\venv\Scripts\activate
Then you can
cd C:\Program Files\IBM\ILOG\CPLEX_Studio201\cplex\python
pip install .
Docplex has a check_list.py script, which helps diagnose presence and location of cplex versions. In a terminal where Python is present, type
$ python -m docplex.mp.check_list
The answer looks like:
* system is: Windows 64bit
* Python version 3.7.8, located at: C:\python\anaconda2020.02\envs\docplex37\python.exe
* docplex is present, version is 2.20.204
* CPLEX library is present, version is 12.10.0.0, located at: C:\OPTIM\cplex_distrib\cplex1210R0\python\3.7\x64_win64
* pandas is present, version is 1.1.4
From the check list output you posted, I can see that you installed cos201.
Docplex need the Python/Cplex interface located inside cos, in your case:
C:/Program Files/IBM/ILOG/CPLEX_Studio201/cplex/python/3.7/x64_win64
This path should be added as a content root in your Pycharm project (File/Settings/Project Structure -> add content root
To check this, open a Python console tab in Pycharm, and try
import cplex
Once you add the right path , this should work.
You can then run the check list from within the console:
from docplex.mp.check_list import run_docplex_check_list
run_docplex_check_list()
Once this works, your program should solve OK inside Pycharm.
This said, I see your version of docplex is 2.15, which is older than CPLEX 20.1. You should update DOcplex to the latest version, which is compatible with CPLEX 20.1.
I have python 3.2 on my pc and i want to be able to run the following:
'pip install requests' and 'pip install selenium'.
To do this i know i need to install pip from here -> https://pip.pypa.io/en/stable/installing/
But when I click on the file python comes up and closes again right away and pip is not installed.
I tried running it through IDLE and get the following:
> Traceback (most recent call last):
File "C:\Users\Jarratt\Desktop\get-pip.py", line 17759, in <module>
main()
File "C:\Users\Jarratt\Desktop\get-pip.py", line 162, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\Jarratt\Desktop\get-pip.py", line 110, in bootstrap
import setuptools # noqa
File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\extension.py", line 8, in <module>
File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\dist.py", line 19, in <module>
File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\pkg_resources\__init__.py", line 106, in <module>
warnings.warn(msg)
File "C:\Python32\lib\idlelib\PyShell.py", line 59, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'
>>>
You need to run it from the command line:
Download https://bootstrap.pypa.io/get-pip.py save somewhere so that you could find it like "C:\".
Open "Start Menu" and in execute type "cmd" and [Enter], or search for "Standard" folder in "Start Menu" and open "Command line" there.
In command line type and execute "python C:\get-pip.py" or "python3 C:\get-pip.py".
Usually works fine this way.
Looks like you are new to python, But pip.exe is a command
and you have to run it from command line, or with run, or by manually clicking on it's icon. You can use this code if you want to:
>>> import os
>>> os.system("pip")
I am attempting to install the openstack nova client on my Mac (10.4.8)
nova = https://github.com/openstack/python-novaclient#command-line-api
python --version
Python 2.7.2
I successfully got nova installed (after installing pip)
When I run the client, I get the following error
foo#bar-macbook-pro:~$ nova
Traceback (most recent call last):
File "/usr/local/bin/nova", line 6, in <module>
from novaclient.shell import main
File "/Library/Python/2.7/site-packages/novaclient/__init__.py", line 15, in <module>
import pbr.version
ImportError: No module named pbr.version
In my research, I have found conflicting information about pbr, some say it is required for nova, while others say it isn't required for nova.
https://github.com/rackspace/pyrax/issues/121
When I attempt to install pbr, I see the following error.
foo#bar-macbook-pro:~$ sudo python ~/Downloads/pbr/setup.py install
Traceback (most recent call last):
File "setup.py", line 22, in <module>
**util.cfg_to_args())
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/util.py", line 241, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/__init__.py", line 27, in setup_hook
metadata_config.run()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/base.py", line 29, in run
self.hook()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/metadata.py", line 28, in hook
self.config['name'], self.config.get('version', None))
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 817, in get_version
version = _get_version_from_git(pre_version)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 776, in _get_version_from_git
"git --git-dir=\"" + git_dir + "\" describe --always").replace(
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 220, in _run_shell_command
stderr=err_location)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
TypeError: must be encoded string without NULL bytes, not str
Is there anything apparent that would explain why I can not get the library installed?
Surely I must not be the first person to try and install nova on OS X.
Over a year later, I finally got this working on OS X Yosemite
sudo pip install python-novaclient
I did not have to install pbr.
I did the install based on venv:
virtualenv venv_name
source venv_name/bin/activate
pip install python-novaclient fabric
In my case, I had a mixup in which python I was using by way of fabric being installed globally.
Prior: rf -rf all my virtualenvs, rf -rf all references to novaclient (locally, and globally), and deleted a global install of fabric which was calling the novaclient.
Also as a precaution, I do not install pip globally, and only use it without sudo in virtualenvs.
I'm trying to use the Fabric 0.1.1 deploy tool (http://docs.fabfile.org/) on Windows and we're running into an issue with the readline module. I've been through various threads but can't seem to solve the issue. It's important because we can't deploy applications from Windows based machines.
C:\Documents and Settings\dev\Desktop\deploy>fab
Traceback (most recent call last):
File "C:\python\Scripts\fab-script.py", line 8, in <module>
load_entry_point('fabric==0.1.1', 'console_scripts', 'fab')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 277, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 2180, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 1913, in load
File "build\bdist.win32\egg\fabric.py", line 25, in <module>
**ImportError: No module named readline**
Installing the module results in:
**easy_install readline**
Searching for readline
Reading http://pypi.python.org/simple/readline/
Reading http://www.python.org/
Best match: readline 2.6.4
Downloading http://pypi.python.org/packages/source/r/readline/readline-2.6.4.tar
.gz#md5=7568e8b78f383443ba57c9afec6f4285
Processing readline-2.6.4.tar.gz
Running readline-2.6.4\setup.py -q bdist_egg --dist-dir c:\docume~1\ji81b9~1.che
\locals~1\temp\easy_install-pzkz1a\readline-2.6.4\egg-dist-tmp-szs2ps
Traceback (most recent call last):
File "C:\python\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1671, in main
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1659, in with_ei_usage
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1675, in <lambda>
File "c:\python\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "c:\python\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "c:\python\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 211, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 446, in easy_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 476, in install_item
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 655, in install_eggs
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 930, in build_and_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 919, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 27, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 63, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 29, in <lambda>
File "setup.py", line 93, in <module>
AttributeError: 'module' object has no attribute 'symlink'
Has anybody solved this issue or can anybody suggest a workaround?
The readline module you are trying to install with easy_install is for OS X, not windows. There are Windows-compatible replacements for readline out there but perhaps you should first try updating fabric itself to a more current version (0.9 is out there now).
Grepping the source of the 0.9 version does not find any dependencies on readline.
Following these steps exactly worked for me:
1) Installed using the MSI installer for x86 from here.
2) Installed in the default C:\Python27 directory.
3) Create a new directory: C:\Python27\Scripts
4) Added C:\Python27 and C:\Python27\Scripts to the system path:
5) Download the distribute_setup.py from here into C:\Python27\Scripts
6) Open a command line, navigate to C:\Python27\Scripts, run: 'python distribute_setup.py'
7) now run 'easy_install pip'
8) now run 'pip install fabric'
9) You should get an error saying PyCrypto couldn't install. You can download the pre-build Windows binary from here. Run this to install PyCrypto.
10) run 'pip install fabric' again and it should say everything is installed.
11) in a different directory (let's say c:\dev\hello) create a fabfile.py and add the following code:
def hello(name="world"):
print("Hello %s!" % name)
12) cd to this directory and run 'fab hello:working'. You should see output say
Hello working!
Done.
Give this readline a try. It is a module for Windows that allows additional features in IPython that aren't native and might work with what you are trying to do.
0.1.1 is an older version, I believe. I have no problem installing Fabric on Windows with ActivePython (w/ PyPM):
C:\> pypm install fabric
Ready to perform these actions:
The following packages will be installed:
fabric-0.9.0 pycrypto-2.0.1
Get: [pypm.activestate.com] fabric 0.9.0-1
Get: [pypm.activestate.com] pycrypto 2.0.1-1
Installing fabric-0.9.0
Fixing script C:\Users\sridharr\AppData\Roaming\Python\Scripts\fab-script.py
Installing pycrypto-2.0.1
Download and run easy_install installer for your python version from http://pypi.python.org/pypi/setuptools#downloads . ie: setuptools-0.6c11.win32-py2.6.exe
On the command prompt, lauch easy_install -U fabric to install the last fabric release.
Readline should be available with Cygwin, if you want to move your entire stack in that direction.