Repository navigation
Trouble Installing Pythonnet for Anaconda - Newbie #780
Description
Environment
- Pythonnet version: 2.3.0
- Python version: 3.7
- Operating System: Windows 7
- Distribution: Anaconda
Details
-
I'm attempting to install Pythonnet on my work computer via the Anaconda Prompt
- The easy ways to download package appear to be blocked (see 1st error in post below)
- Similar error message encountered when attempting to install using Conda (conda install -c pythonnet pythonnet).
- SSL error messages may be related to user restrictions on my work laptop, but not sure
- I have not found any way around this
-
Ultimately, I assume that I can only install by downloading the zip file due to my security limitations
- I am very new to programming / python, so I have no clue how to do this
- When I run the code listed in the wiki, I get another error message (see 2nd error in post below)
- When I try to run pip install directly on the extracted zip file location, I get a different error message (see 3rd error in post below)
Summary of Question:
What is a simple step by step process for performing an install of Pythonnet given my restrictions?
I'm completely new to this so I'm sure I'm doing something very basic incorrectly.
If there is a better forum for this basic question, please let me know.
Thanks!
References:
https://github.com/pythonnet/pythonnet/wiki/Installation
1st Error for running pip install pythonnet - code from Anaconda command prompt:
(base) C:\Users\MATT>pip install pythonnet
Collecting pythonnet
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b4
78b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b4
78b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b4
78b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b4
78b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b4
78b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=
'files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/89
/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0
.tar.gz (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIF
Y_FAILED] certificate verify failed: unable to get local issuer certificate (_ss
l.c:1045)')))
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
(base) C:\Users\MATT>
2nd Error for running my interpretation of instructions from wiki - code from Anaconda command prompt:
(base) C:\Users\MATT>cd C:\Users\MATT\Downloads\pythonnet-master\pythonnet-mas
ter
(base) C:\Users\MATT\Downloads\pythonnet-master\pythonnet-master>python setup.p
y bdist_wheel --xplat
running bdist_wheel
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
(base) C:\Users\MATT\Downloads\pythonnet-master\pythonnet-master>
3rd Error for running pip install from downloaded zip folder - code from Anaconda command prompt:
(base) C:\Users\MATT>pip install C:\Users\MATT\Downloads\pythonnet-master\pyth
onnet-master
Processing c:\users\Matt\downloads\pythonnet-master\pythonnet-master
Building wheels for collected packages: pythonnet
Running setup.py bdist_wheel for pythonnet ... error
Complete output from command C:\Users\MATT\AppData\Local\Continuum\anaconda3
python.exe -u -c "import setuptools, tokenize;file='C:\Users\MATT\AppDat
a\Local\Temp\pip-req-build-xgqyixsc\setup.py';f=getattr(tokenize, 'open', op
en)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, _
file_, 'exec'))" bdist_wheel -d C:\Users\MATT\AppData\Local\Temp\pip-wheel-0_
g8ej3_ --python-tag cp37:
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.7.1.
NuGet.exe is up to date.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x
86)\MSBuild\14.0\bin\amd64'.
All packages listed in packages.config are already installed.
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc\setup.py", li
ne 534, in
zip_safe=False,
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\site-packages\set
uptools_init_.py", line 140, in setup
return distutils.core.setup(**attrs)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\core.py
", line 148, in setup
dist.run_commands()
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py
", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py
", line 985, in run_command
cmd_obj.run()
File "C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc\setup.py", li
ne 482, in run
return bdist_wheel.bdist_wheel.run(self)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\site-packages\whe
el\bdist_wheel.py", line 202, in run
self.run_command('build')
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\cmd.py"
, line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py
", line 985, in run_command
cmd_obj.run()
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\command
\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\cmd.py"
, line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\dist.py
", line 985, in run_command
cmd_obj.run()
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\command
\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\command
\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\Users\MATT\AppData\Local\Continuum\anaconda3\lib\distutils\command
\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc\setup.py", li
ne 257, in build_extension
manifest = self._get_manifest(dest_dir)
File "C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc\setup.py", li
ne 274, in _get_manifest
mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True)
File "C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc\setup.py", li
ne 399, in _find_msbuild_tool
raise RuntimeError("{0} could not be found".format(tool))
RuntimeError: mt.exe could not be found
Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
Complete output from command C:\Users\MATT\AppData\Local\Continuum\anaconda
3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\MATT\AppD
ata\Local\Temp\pip-req-build-xgqyixsc\setup.py';f=getattr(tokenize, 'open',
open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,
file, 'exec'))" install --record C:\Users\MATT\AppData\Local\Temp\pip-reco
rd-wux2fqp2\install-record.txt --single-version-externally-managed --compile:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
Command "C:\Users\MATT\AppData\Local\Continuum\anaconda3\python.exe -u -c "impo
rt setuptools, tokenize;file='C:\Users\MATT\AppData\Local\Temp\pip-re
q-build-xgqyixsc\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.r
ead().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" ins
tall --record C:\Users\MATT\AppData\Local\Temp\pip-record-wux2fqp2\install-reco
rd.txt --single-version-externally-managed --compile" failed with error code 1 i
n C:\Users\MATT\AppData\Local\Temp\pip-req-build-xgqyixsc
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
(base) C:\Users\MATT>
Activity
den-run-ai commentedon Nov 19, 2018
@Mattpdrexel your first issue is about ssl certificate error, just upgrade pip like suggested in the error message:
https://stackoverflow.com/q/25981703/2230844
For second error you did not provide the full output from the console, hence no resolution.
For the third error the installation could not locate mt.exe on your system. What VS version do you have installed and what is the path to mt.exe on your system? We are using VS 2017 at the moment.
Mattpdrexel commentedon Nov 20, 2018
denfromufa,
Thanks for the guidance. After figuring out how to specify trusted hosts, I was able to upgrade my pip, setuptools and wheel. I also installed git through conda.
Now when I attempt to perform an install using the following command:
pip install git+https://github.com/pythonnet/pythonnet --trusted-host github.comI get the following error messages:
Failed building wheel for pythonnetand later
error: option --single-version-externally-managed not recognizedP.S.: I was not able to find an mt.exe file on my machine when looking in the expected folder locations:
I'm not sure if I have mt.exe installed on my machine at all.
See below for full error message from attempt to install using pip install git+etc.:
den-run-ai commentedon Nov 20, 2018
just grab the wheels from appveyor artifacts for master branch. you cannot build from source without mt.exe - it comes with the MSVC or WinSDK:
https://docs.microsoft.com/en-us/windows/desktop/sbscs/mt-exe
The second error
error: option --single-version-externally-managed not recognizedcan be avoid by building using setup.py. It is tracked here:#731
den-run-ai commentedon Nov 20, 2018
new users should just do
pip install pythonnetMattpdrexel commentedon Nov 20, 2018
denfromufa,
Thanks for the additional response. I think I'll need to get a recent version of Windows SDK installed on my machine in order to get mt.exe. I'll pursue this now.
In the meantime, I am not familiar with appveyor artifacts (what they are or how to use them). I'll need to look into this, but I feel like this may be too advanced for my current skill set.
Thanks for the help.
den-run-ai commentedon Nov 20, 2018
den-run-ai commentedon Nov 21, 2018
You can get unofficial pythonnet for python 3.7 also here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonnet
or grab the wheels from appveyor artifacts for master branch
Mattpdrexel commentedon Nov 23, 2018
denfromufa,
Looks like the unoffical install worked without a problem using pip install!
Thanks for all the help!
I'll eventually determine how to perform the official install once I identify issue with the mt.exe file location, but this works great for now.
Thank you so much for all the help!