I'm attempting to install Pythonnet on my work computer via the Anaconda Prompt
Ultimately, I assume that I can only install by downloading the zip file due to my security limitations
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\Temppip-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 "
File "C:\Users\MATT\AppData\Local\Temppip-req-build-xgqyixscsetup.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\Temppip-req-build-xgqyixscsetup.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\Temppip-req-build-xgqyixscsetup.py", li
ne 257, in build_extension
manifest = self._get_manifest(dest_dir)
File "C:\Users\MATT\AppData\Local\Temppip-req-build-xgqyixscsetup.py", li
ne 274, in _get_manifest
mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True)
File "C:\Users\MATT\AppData\Local\Temppip-req-build-xgqyixscsetup.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\Temppip-reco
rd-wux2fqp2install-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\Temppip-record-wux2fqp2install-reco
rd.txt --single-version-externally-managed --compile" failed with error code 1 i
n C:\Users\MATT\AppData\Local\Temppip-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>
@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.
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.com
I get the following error messages:
Failed building wheel for pythonnet
and later
error: option --single-version-externally-managed not recognized
P.S.: I was not able to find an mt.exe file on my machine when looking in the expected folder locations:
C:\Program Files (x86)\Microsoft Visual Studio 10.0
C:\Program Files (x86)\Microsoft Visual Studio 14.0
C:\Program Files (x86)\Microsoft SDKs
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.:
(base) C:\>git config --system http.sslVerify false (base) C:\>pip install git+https://github.com/pythonnet/pythonnet --trusted-host github.com Collecting git+https://github.com/pythonnet/pythonnet Cloning https://github.com/pythonnet/pythonnet to c:\users\pdmp0\appdata\local \temp\pip-req-build-1foofr96 Building wheels for collected packages: pythonnet Running setup.py bdist_wheel for pythonnet ... error Complete output from command c:\users\pdmp0\appdata\local\continuum\anaconda3\ python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PDMP0\\AppDat a\\Local\\Temp\\pip-req-build-1foofr96\\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\PDMP0\AppData\Local\Temp\pip-wheel-jm pwu8r7 --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.1.0. Updating NuGet.exe to 4.7.1. Update successful. MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x 86)\MSBuild\14.0\bin\amd64'. Restoring NuGet package NUnit.ConsoleRunner.3.7.0. Restoring NuGet package NUnit.3.7.1. Restoring NuGet package UnmanagedExports.1.2.7. Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\PDMP0\AppData\L ocal\Temp\pip-req-build-1foofr96\packages' Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\PDMP0\AppData\Loca l\Temp\pip-req-build-1foofr96\packages' Adding package 'NUnit.3.7.1' to folder 'C:\Users\PDMP0\AppData\Local\Temp\pip- req-build-1foofr96\packages' Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\PDMP0\AppData\Local \Temp\pip-req-build-1foofr96\packages' Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\PDMP0\AppData\Lo cal\Temp\pip-req-build-1foofr96\packages' Added package 'NUnit.3.7.1' to folder 'C:\Users\PDMP0\AppData\Local\Temp\pip-r eq-build-1foofr96\packages' NuGet Config files used: C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\NuGet.Config C:\Users\PDMP0\AppData\Roaming\NuGet\NuGet.Config Feeds used: C:\Users\PDMP0\.nuget\packages\ https://dotnet.myget.org/F/dotnet-core/api/v3/index.json https://api.nuget.org/v3/index.json Installed: 3 package(s) to packages.config projects Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\setup.py", li ne 534, in <module> zip_safe=False, File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\site-packages\set uptools\__init__.py", line 143, in setup return distutils.core.setup(**attrs) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\core.py ", line 148, in setup dist.run_commands() File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\dist.py ", line 966, in run_commands self.run_command(cmd) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\dist.py ", line 985, in run_command cmd_obj.run() File "C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\setup.py", li ne 482, in run return bdist_wheel.bdist_wheel.run(self) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\site-packages\whe el\bdist_wheel.py", line 188, in run self.run_command('build') File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\cmd.py" , line 313, in run_command self.distribution.run_command(command) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\dist.py ", line 985, in run_command cmd_obj.run() File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\command \build.py", line 135, in run self.run_command(cmd_name) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\cmd.py" , line 313, in run_command self.distribution.run_command(command) File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\dist.py ", line 985, in run_command cmd_obj.run() File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\command \build_ext.py", line 339, in run self.build_extensions() File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\command \build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "c:\users\pdmp0\appdata\local\continuum\anaconda3\lib\distutils\command \build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\setup.py", li ne 257, in build_extension manifest = self._get_manifest(dest_dir) File "C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\setup.py", li ne 274, in _get_manifest mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True) File "C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\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 Installing collected packages: pythonnet Running setup.py install for pythonnet ... error Complete output from command c:\users\pdmp0\appdata\local\continuum\anaconda 3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PDMP0\\AppD ata\\Local\\Temp\\pip-req-build-1foofr96\\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\PDMP0\AppData\Local\Temp\pip-reco rd-0smk2w6g\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\pdmp0\appdata\local\continuum\anaconda3\python.exe -u -c "impo rt setuptools, tokenize;__file__='C:\\Users\\PDMP0\\AppData\\Local\\Temp\\pip-re q-build-1foofr96\\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\PDMP0\AppData\Local\Temp\pip-record-0smk2w6g\install-reco rd.txt --single-version-externally-managed --compile" failed with error code 1 i n C:\Users\PDMP0\AppData\Local\Temp\pip-req-build-1foofr96\ (base) C:\>
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 recognized can be avoid by building using setup.py. It is tracked here:
new users should just do pip install pythonnet
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.
Appveyor artifacts are documented in the installation wiki.
mt.exe is better obtained via MSVC installation in VS 2017, not via WinSdk.
On Tue, Nov 20, 2018, 2:30 PM Mattpdrexel notifications@github.com wrote:
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.
—
You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub
https://github.com/pythonnet/pythonnet/issues/780#issuecomment-440418828,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHgZ5aL6GXVw9FMwqcmlbejvg7hLwcROks5uxGZLgaJpZM4Ynq5p
.
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
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!
Most helpful comment
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