添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to install pythonnet on a machine with no internet access. On a connected machine I downloaded pythonnet-master.zip from Github, and pythonnet-2.4.0.tar.gz from pypi.

When I try pip install pythonnet-2.4.0.tar.gz , I get the error The remote name could not be resolved: 'www.nuget.org.

I then used conda install nuget-3.2.0.10516-py34_0.tar.bz2 to take care of nuget. The installation was successful, but I still cannot install pythonnet.

My attempts using pythonnet-master.zip and conda install also failed. Any ideas would be helpful.

Here is the full error output:

(raman_env) C:\Users\Administrator\Desktop\eric\software>pip install pythonnet-2
.4.0.tar.gz
Processing c:\users\administrator\desktop\eric\software\pythonnet-2.4.0.tar.gz
Building wheels for collected packages: pythonnet
  Building wheel for pythonnet (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\envs\raman_env\python.exe' -u -c 'import s
ys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local
\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1
\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\setup.py'"'"';f=getattr(tokenize
, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'
"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C
:\Users\ADMINI~1\AppData\Local\Temp\pip-wheel-vi5w5zft' --python-tag cp37
       cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_ext
  Checking for updates from https://www.nuget.org/api/v2/.
  The remote name could not be resolved: 'www.nuget.org'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
 line 658, in <module>
      zip_safe=False,
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\site-packages\setuptools\_
_init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\core.py", line 1
48, in setup
      dist.run_commands()
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
66, in run_commands
      self.run_command(cmd)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
      cmd_obj.run()
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
 line 610, in run
      return bdist_wheel.bdist_wheel.run(self)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\site-packages\wheel\bdist_
wheel.py", line 192, in run
      self.run_command('build')
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\cmd.py", line 31
3, in run_command
      self.distribution.run_command(command)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
      cmd_obj.run()
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build.py
", line 135, in run
      self.run_command(cmd_name)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\cmd.py", line 31
3, in run_command
      self.distribution.run_command(command)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\dist.py", line 9
85, in run_command
      cmd_obj.run()
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 340, in run
      self.build_extensions()
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\distutils\command\build_ex
t.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
 line 245, in build_extension
      self._install_packages()
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\setup.py",
 line 424, in _install_packages
      subprocess.check_call(cmd, shell=use_shell)
    File "C:\ProgramData\Anaconda3\envs\raman_env\lib\subprocess.py", line 347,
in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'tools\nuget\nuget.exe update -self' re
turned non-zero exit status 1.
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: 'C:\ProgramData\Anaconda3\envs\raman_env\python.exe' -u -c 'import
 sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Loc
al\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI
~1\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\setup.py'"'"';f=getattr(tokeni
ze, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\
n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --recor
d 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-31isrm6o\install-record.txt'
--single-version-externally-managed --compile
         cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-8jks801m\
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help
    error: option --single-version-externally-managed not recognized
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\envs\ra
man_env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'
C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-req-build-8jks801m\\setup.py'"'"'
; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-req-build-8jks801
m\\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\ADMINI~1\AppData\Local\Temp\pip-rec
ord-31isrm6o\install-record.txt' --single-version-externally-managed --compile C
heck the logs for full command output.

The setup.py of pythonnet is trying to run nugget.exe update --self which fails in you system because of the missing internet connection. I can think of two possible solutions:

  • Instead of a source install, try to download the right whl file. On pypi, there are only ones for cp37 and below. If you are running pyhton 3.8, you can find the right wheel file here

  • Extract the tar.gz archive and comment line 424: subprocess.check_call(cmd, shell=use_shell). Then run python setup.py install. This will prevent setup from trying to update nugget during the installation process

  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.