Skip to content

Unable to install pythonnet for Python 3.6.6 on Ubuntu 18.04 #741

Closed

Description

@SamoPP

Environment

  • Pythonnet version: master from github
  • Python version: 3.6.6
  • Operating System: Ubuntu 18.04
  • Mono: Mono JIT compiler version 5.14.0.177 (tarball Mon Aug 6 09:07:45 UTC 2018)
  • Clang: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
  • gcc: gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0

Details

  • Describe what you were trying to get done.

    I wanted to install pythonnet.

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

$ pip install pythonnet
Collecting pythonnet
  Using cached https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Building wheels for collected packages: pythonnet
  Running setup.py bdist_wheel for pythonnet ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-mm2agm3f/pythonnet/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 /tmp/pip-wheel-wz7tt5qr --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  Checking for updates from https://www.nuget.org/api/v2/.
  Currently running NuGet.exe 3.5.0.
  Updating NuGet.exe to 4.7.1.
  Update successful.
  MSBuild auto-detection: using msbuild version '15.0' from '/usr/lib/mono/msbuild/15.0/bin'.
  Restoring NuGet package NUnit.ConsoleRunner.3.6.0.
  Restoring NuGet package UnmanagedExports.1.2.7.
  Restoring NuGet package NUnit.3.6.0.
  Adding package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  Adding package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  Adding package 'NUnit.3.6.0' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  Added package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  Added package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  Added package 'NUnit.3.6.0' to folder '/tmp/pip-install-mm2agm3f/pythonnet/packages'
  
  NuGet Config files used:
      /home/kilometrics/.config/NuGet/NuGet.Config
  
  Feeds used:
      /home/kilometrics/.nuget/packages/
      https://api.nuget.org/v3/index.json
  
  Installed:
      3 package(s) to packages.config projects
  clang: warning: /usr/include/python3.6m: 'linker' input unused [-Wunused-command-line-argument]
  Traceback (most recent call last):
    File "tools/geninterop/geninterop.py", line 292, in <module>
      sys.exit(main())
    File "tools/geninterop/geninterop.py", line 274, in main
      ast = parser.parse(python_h)
    File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 152, in parse
      debug=debuglevel)
    File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse
      return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
    File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
      tok = call_errorfunc(self.errorfunc, errtoken, self)
    File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc
      r = errorfunc(token)
    File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 1848, in p_error
      column=self.clex.find_tok_column(p)))
    File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 67, in _parse_error
      raise ParseError("%s: %s" % (coord, msg))
  pycparser.plyparser.ParseError: /usr/include/crypt.h:33:6: before: __THROW
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-mm2agm3f/pythonnet/setup.py", line 405, in <module>
      zip_safe=False,
    File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.6/dist-packages/wheel/bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/tmp/pip-install-mm2agm3f/pythonnet/setup.py", line 191, in build_extension
      subprocess.check_call([sys.executable, geninterop, interop_file])
    File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', 'tools/geninterop/geninterop.py', 'src/runtime/interop36m.cs']' returned non-zero exit status 1.
  
  ----------------------------------------
  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 /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-mm2agm3f/pythonnet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-x4y7l5j6/install-record.txt --single-version-externally-managed --compile:
    running install
    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 '15.0' from '/usr/lib/mono/msbuild/15.0/bin'.
    All packages listed in packages.config are already installed.
    clang: warning: /usr/include/python3.6m: 'linker' input unused [-Wunused-command-line-argument]
    Traceback (most recent call last):
      File "tools/geninterop/geninterop.py", line 292, in <module>
        sys.exit(main())
      File "tools/geninterop/geninterop.py", line 274, in main
        ast = parser.parse(python_h)
      File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 152, in parse
        debug=debuglevel)
      File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse
        return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
      File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
        tok = call_errorfunc(self.errorfunc, errtoken, self)
      File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc
        r = errorfunc(token)
      File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 1848, in p_error
        column=self.clex.find_tok_column(p)))
      File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 67, in _parse_error
        raise ParseError("%s: %s" % (coord, msg))
    pycparser.plyparser.ParseError: /usr/include/crypt.h:33:6: before: __THROW
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-mm2agm3f/pythonnet/setup.py", line 405, in <module>
        zip_safe=False,
      File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "/usr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "/tmp/pip-install-mm2agm3f/pythonnet/setup.py", line 191, in build_extension
        subprocess.check_call([sys.executable, geninterop, interop_file])
      File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python3', 'tools/geninterop/geninterop.py', 'src/runtime/interop36m.cs']' returned non-zero exit status 1.
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-mm2agm3f/pythonnet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-x4y7l5j6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-mm2agm3f/pythonnet/

Activity

  1. den-run-ai commented on Sep 25, 2018

    @den-run-ai
    Contributor

    @SamoPP there is a fix for this issue in this branch, but I have other issues in that PR related to mono/msbuild/nuget/travis-ci:

    #698

  2. rdnobrega commented on Sep 26, 2018

    @rdnobrega

    HI @denfromufa , I'm having the exact same issue on my machine (Windows 10/64/py 3.7) when trying to install pythonnet. You said there is already a fix for this in this branch, though I don't know what that is and how do I fix it. Can you help me get this solved? I'm new to python and github it self so any clues would be nice.. ^^

  3. den-run-ai commented on Sep 26, 2018

    @den-run-ai
    Contributor

    @rdnobrega if you are new to python, it is probably just easier to use python 3.6 and upgrade later when python ecosystem has picked up considerably the new version 3.7.

    you can install from PR branches according to wiki instructions:

    https://github.com/pythonnet/pythonnet/wiki/Installation#github-installation-from-master-branch

    on windows @cgohlke provides the unofficial wheels:

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonnet

  4. rdnobrega commented on Sep 26, 2018

    @rdnobrega

    Thanks @denfromufa. I actually installed just fine on my old computer W8/32b/py36. However, i did not managed to install the py37 branch on my main computer. It gives this error:

    Processing d:\pythonnet-py37
    Building wheels for collected packages: pythonnet
      Running setup.py bdist_wheel for pythonnet ... error
      Complete output from command d:\programas\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\rdnob\\AppData\\Local\\Temp\\pip-req-build-mnjw0n2b\\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\rdnob\AppData\Local\Temp\pip-wheel-2wu_6vs5 --python-tag cp37:
      running bdist_wheel
      running build
      running build_ext
      Verifique se h  atualiza‡äes de https://www.nuget.org/api/v2/.
      Atualmente executando NuGet.exe 4.1.0.
      Atualizando NuGet.exe para 4.7.1.
      Atualiza‡Æo bem-sucedida.
      MSBuild auto-detection: using msbuild version '15.7.180.61344' from 'd:\Programas\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'.
      Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
      Restoring NuGet package UnmanagedExports.1.2.7.
      Restoring NuGet package NUnit.3.7.1.
      Adding package 'NUnit.3.7.1' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
      Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
      Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
      Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
      Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
      Added package 'NUnit.3.7.1' to folder 'C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\packages'
    
      NuGet Config files used:
          C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\NuGet.Config
          C:\Users\rdnob\AppData\Roaming\NuGet\NuGet.Config
          C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
    
      Feeds used:
          C:\Users\rdnob\.nuget\packages\
          https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
          https://api.nuget.org/v3/index.json
          C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
    
      Installed:
          3 package(s) to packages.config projects
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\setup.py", line 527, in <module>
          zip_safe=False,
        File "d:\programas\python\lib\site-packages\setuptools\__init__.py", line 140, in setup
          return distutils.core.setup(**attrs)
        File "d:\programas\python\lib\distutils\core.py", line 148, in setup
          dist.run_commands()
        File "d:\programas\python\lib\distutils\dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "d:\programas\python\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\setup.py", line 475, in run
          return bdist_wheel.bdist_wheel.run(self)
        File "d:\programas\python\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
          self.run_command('build')
        File "d:\programas\python\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "d:\programas\python\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "d:\programas\python\lib\distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "d:\programas\python\lib\distutils\cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "d:\programas\python\lib\distutils\dist.py", line 985, in run_command
          cmd_obj.run()
        File "d:\programas\python\lib\distutils\command\build_ext.py", line 339, in run
          self.build_extensions()
        File "d:\programas\python\lib\distutils\command\build_ext.py", line 448, in build_extensions
          self._build_extensions_serial()
        File "d:\programas\python\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
          self.build_extension(ext)
        File "C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\setup.py", line 257, in build_extension
          manifest = self._get_manifest(dest_dir)
        File "C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\setup.py", line 274, in _get_manifest
          mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True)
        File "C:\Users\rdnob\AppData\Local\Temp\pip-req-build-mnjw0n2b\setup.py", line 392, 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 d:\programas\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\rdnob\\AppData\\Local\\Temp\\pip-req-build-mnjw0n2b\\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\rdnob\AppData\Local\Temp\pip-record-bd7ox3gw\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
    
    

    Just putting here for dev's to see.. I'm gonna rollback to py36 as you suggested, thanks! ^^

  5. SamoPP commented on Sep 28, 2018

    @SamoPP
    Author

    I am trying to install from pull request but it looks like I do not know how (please see below). Can you please guide me on how to install from mentioned pull request. Thanks.

    $ pip install git+https://github.com/yagweb/pythonnet@py37 Collecting git+https://github.com/yagweb/pythonnet@py37 Cloning https://github.com/yagweb/pythonnet (to revision py37) to /tmp/pip-req-build-7sdv9clx Did not find branch or tag 'py37', assuming revision or ref. error: pathspec 'py37' did not match any file(s) known to git. Command "git checkout -q py37" failed with error code 1 in /tmp/pip-req-build-7sdv9clx

  6. den-run-ai commented on Sep 28, 2018

    @den-run-ai
    Contributor

    @SamoPP wrong repo: "github.com/yagweb" should be "github.com/pythonnet"

  7. den-run-ai commented on Oct 21, 2018

    @den-run-ai
    Contributor

    this parsing error has been fixed and merged to master branch:

    #698

  8. alexbprofit commented on Oct 20, 2021

    @alexbprofit
    alex@DESKTOP-9503ULJ:~$ pip install git+https://github.com/pythonnet/pythonnet
    Collecting git+https://github.com/pythonnet/pythonnet
      Cloning https://github.com/pythonnet/pythonnet to /tmp/pip-req-build-kgt9m0z0
      Running command git clone -q https://github.com/pythonnet/pythonnet /tmp/pip-req-build-kgt9m0z0
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Collecting clr-loader
      Using cached clr_loader-0.1.6-py3-none-any.whl (45 kB)
    Requirement already satisfied: cffi>=1.13 in ./.local/lib/python3.8/site-packages (from clr-loader->pythonnet==3.0.0.dev1) (1.15.0)
    Requirement already satisfied: pycparser in ./.local/lib/python3.8/site-packages (from cffi>=1.13->clr-loader->pythonnet==3.0.0.dev1) (2.20)
    Building wheels for collected packages: pythonnet
      Building wheel for pythonnet (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 /tmp/tmpb35zpdfw build_wheel /tmp/tmppx0ae33e
           cwd: /tmp/pip-req-build-kgt9m0z0
      Complete output (15 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      copying clr.py -> build/lib
      creating build/lib/pythonnet
      copying pythonnet/__init__.py -> build/lib/pythonnet
      creating build/lib/pythonnet/find_libpython
      copying pythonnet/find_libpython/__main__.py -> build/lib/pythonnet/find_libpython
      copying pythonnet/find_libpython/__init__.py -> build/lib/pythonnet/find_libpython
      running build_dotnet
      Running dotnet build...
      dotnet build src/runtime/Python.Runtime.csproj --configuration release --output /tmp/pip-req-build-kgt9m0z0/build/lib/pythonnet/runtime
      error: command 'dotnet' failed with exit status 1
      ----------------------------------------
      ERROR: Failed building wheel for pythonnet
    Failed to build pythonnet
    ERROR: Could not build wheels for pythonnet which use PEP 517 and cannot be installed directly
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions