Skip to content

Fail to install pythonnet for python 2.7 #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
harryln opened this issue Jun 14, 2018 · 9 comments
Closed

Fail to install pythonnet for python 2.7 #686

harryln opened this issue Jun 14, 2018 · 9 comments

Comments

@harryln
Copy link

harryln commented Jun 14, 2018

Environment

  • Pythonnet version: 2.3
  • Python version: python 2.7.12
  • Operating System: Ubuntu 16 (Linux Mint 18.3 under virtual box of Windows 10)

Details

I have tried to install pythonnet for python 2.7 by:

   sudo pip2 install pythonnet

The trace-back info is following:

Collecting pythonnet
  Downloading https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz (1.5MB)
Installing collected packages: pythonnet
  Running setup.py install for pythonnet: started
    Running setup.py install for pythonnet: finished with status 'error'
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-N2KiUY/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-zgifla/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 3.5.0.
    Updating NuGet.exe to 4.6.2.
    Update successful.
    MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
    
    >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
    
    MSBUILD: error MSBUILD0004: Too many project files specified
    
    WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
    Restoring NuGet package NUnit.3.6.0.
    Restoring NuGet package NUnit.ConsoleRunner.3.6.0.
    Restoring NuGet package UnmanagedExports.1.2.7.
    Adding package 'NUnit.3.6.0' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    Adding package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    Adding package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    Added package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    Added package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    Added package 'NUnit.3.6.0' to folder '/tmp/pip-install-N2KiUY/pythonnet/packages'
    
    NuGet Config files used:
        /home/wl/.config/NuGet/NuGet.Config
    
    Feeds used:
        /home/wl/.nuget/packages/
        https://api.nuget.org/v3/index.json
    
    Installed:
        3 package(s) to packages.config projects
    
    >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
    
    XBuild Engine Version 14.0
    Mono, Version 5.12.0.226
    Copyright (C) 2005-2013 Various Mono authors
    
    >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
    
    XBuild Engine Version 14.0
    Mono, Version 5.12.0.226
    Copyright (C) 2005-2013 Various Mono authors
    		Configuration: ReleaseMono Platform: x64
    /tmp/pip-install-N2KiUY/pythonnet/src/runtime/Python.Runtime.csproj: error : Error executing task Copy: Error converting Property named 'SourceFiles' with value '$(TargetAssemblyPdb)' to type Microsoft.Build.Framework.ITaskItem[]: Can't concatenate Item list with other strings where an item list is expected ('@(_OutDirItem->'%(FullPath)')', 'Python.Runtime.pdb'). Use semi colon to separate items.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-N2KiUY/pythonnet/setup.py", line 405, in <module>
        zip_safe=False,
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
        self.build_extension(ext)
      File "/tmp/pip-install-N2KiUY/pythonnet/setup.py", line 222, in build_extension
        subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
      File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'xbuild pythonnet.sln /p:Configuration=ReleaseMono /p:Platform=x64 /p:DefineConstants="PYTHON27,PYTHON2,UCS4,MONO_LINUX,PYTHON_WITHOUT_ENABLE_SHARED" /p:PythonBuildDir="/tmp/pip-install-N2KiUY/pythonnet/build/lib.linux-x86_64-2.7" /p:PythonInteropFile="interop27.cs" /verbosity:minimal /t:Build' returned non-zero exit status 1
    
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-N2KiUY/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-zgifla/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-N2KiUY/pythonnet/

What can I do? Many thanks for your help.

@den-run-ai
Copy link
Contributor

This is probably due to newer Mono 5.12 version than Mono 5.10 that we are testing against:

#654

@harryln
Copy link
Author

harryln commented Jun 14, 2018

Many thanks.

I uninstall the newest version of Mono and install it from Linux Mint repository. The version is:

mono --version
Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

Try it again:

sudo -H pip2 install pythonnet

the traceback info is:

Collecting pythonnet
  Downloading https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz (1.5MB)
    100% |████████████████████████████████| 1.5MB 6.3MB/s 
Building wheels for collected packages: pythonnet
  Running setup.py bdist_wheel for pythonnet ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-btbI4x/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-o8bWpe --python-tag cp27:
  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.6.2.
  Update successful.
  
  Unhandled Exception:
  System.MissingMethodException: Method 'Array.Empty' not found.
    at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x415f02c0 + 0x000af> in <filename unknown>:0
    at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x415f0290 + 0x00013> in <filename unknown>:0
    at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x415eff70 + 0x00137> in <filename unknown>:0
    at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x415c5860 + 0x008db> in <filename unknown>:0
    at NuGet.CommandLine.Program.Main (System.String[] args) <0x415c1d50 + 0x00037> in <filename unknown>:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Array.Empty' not found.
    at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x415f02c0 + 0x000af> in <filename unknown>:0
    at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x415f0290 + 0x00013> in <filename unknown>:0
    at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x415eff70 + 0x00137> in <filename unknown>:0
    at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x415c5860 + 0x008db> in <filename unknown>:0
    at NuGet.CommandLine.Program.Main (System.String[] args) <0x415c1d50 + 0x00037> in <filename unknown>:0
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 405, in <module>
      zip_safe=False,
    File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
      self.run_command(cmd_name)
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
      self.build_extension(ext)
    File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 139, in build_extension
      self._install_packages()
    File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 273, in _install_packages
      subprocess.check_call(cmd, shell=use_shell)
    File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'mono tools/nuget/nuget.exe restore pythonnet.sln -o packages' 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/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-btbI4x/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-L0n29b/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    
    Unhandled Exception:
    System.MissingMethodException: Method 'Array.Empty' not found.
      at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x4180dad0 + 0x000af> in <filename unknown>:0
      at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x4180daa0 + 0x00013> in <filename unknown>:0
      at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x4180d790 + 0x00133> in <filename unknown>:0
      at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x417e4860 + 0x008db> in <filename unknown>:0
      at NuGet.CommandLine.Program.Main (System.String[] args) <0x417e0d50 + 0x00037> in <filename unknown>:0
    [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Array.Empty' not found.
      at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x4180dad0 + 0x000af> in <filename unknown>:0
      at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x4180daa0 + 0x00013> in <filename unknown>:0
      at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x4180d790 + 0x00133> in <filename unknown>:0
      at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x417e4860 + 0x008db> in <filename unknown>:0
      at NuGet.CommandLine.Program.Main (System.String[] args) <0x417e0d50 + 0x00037> in <filename unknown>:0
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 405, in <module>
        zip_safe=False,
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
        self.build_extension(ext)
      File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 139, in build_extension
        self._install_packages()
      File "/tmp/pip-install-btbI4x/pythonnet/setup.py", line 269, in _install_packages
        subprocess.check_call(cmd, shell=use_shell)
      File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'mono tools/nuget/nuget.exe update -self' returned non-zero exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-btbI4x/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-L0n29b/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-btbI4x/pythonnet/

Any advice?

@den-run-ai
Copy link
Contributor

den-run-ai commented Jun 14, 2018

Mono 4.2 is too old, follow installation from official Mono website or better follow our travis-ci script:

https://www.mono-project.com/download/stable/#download-lin
https://github.com/pythonnet/pythonnet/blob/master/.travis.yml#L74

@harryln
Copy link
Author

harryln commented Jun 15, 2018

Dear denfromufa,
I downgraded Mono to 5.10.0 following https://www.mono-project.com/download/stable/#download-lin.

mono --version
Mono JIT compiler version 5.10.0.160 (tarball Wed Mar  7 15:30:00 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

and try again:

sudo -H pip2 install pythonnet

the traceback info:

sudo -H pip2 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/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-LvfpKZ/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-8_YxcJ --python-tag cp27:
  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.6.2.
  Update successful.
  MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
  Restoring NuGet package NUnit.ConsoleRunner.3.6.0.
  Restoring NuGet package NUnit.3.6.0.
  Restoring NuGet package UnmanagedExports.1.2.7.
    GET https://api.nuget.org/v3-flatcontainer/unmanagedexports/1.2.7/unmanagedexports.1.2.7.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg
    OK https://api.nuget.org/v3-flatcontainer/unmanagedexports/1.2.7/unmanagedexports.1.2.7.nupkg 428ms
  Installing UnmanagedExports 1.2.7.
  Adding package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
  Added package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.6.0/nunit.consolerunner.3.6.0.nupkg 884ms
  Installing NUnit.ConsoleRunner 3.6.0.
  Adding package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
  Added package 'NUnit.ConsoleRunner.3.6.0' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.6.0/nunit.3.6.0.nupkg 1377ms
  Installing NUnit 3.6.0.
  Adding package 'NUnit.3.6.0' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
  Added package 'NUnit.3.6.0' to folder '/tmp/pip-install-LvfpKZ/pythonnet/packages'
  
  NuGet Config files used:
      /root/.config/NuGet/NuGet.Config
  
  Feeds used:
      https://api.nuget.org/v3/index.json
  
  Installed:
      3 package(s) to packages.config projects
  
  >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
  
  XBuild Engine Version 14.0
  Mono, Version 5.10.0.160
  Copyright (C) 2005-2013 Various Mono authors
  
  >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
  
  XBuild Engine Version 14.0
  Mono, Version 5.10.0.160
  Copyright (C) 2005-2013 Various Mono authors
  		Configuration: ReleaseMono Platform: x64
  /tmp/pip-install-LvfpKZ/pythonnet/src/runtime/Python.Runtime.csproj: error : Error executing task Copy: Error converting Property named 'SourceFiles' with value '$(TargetAssemblyPdb)' to type Microsoft.Build.Framework.ITaskItem[]: Can't concatenate Item list with other strings where an item list is expected ('@(_OutDirItem->'%(FullPath)')', 'Python.Runtime.pdb'). Use semi colon to separate items.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-LvfpKZ/pythonnet/setup.py", line 405, in <module>
      zip_safe=False,
    File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 202, in run
      self.run_command('build')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
      self.run_command(cmd_name)
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/usr/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
      self.build_extension(ext)
    File "/tmp/pip-install-LvfpKZ/pythonnet/setup.py", line 222, in build_extension
      subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
    File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'xbuild pythonnet.sln /p:Configuration=ReleaseMono /p:Platform=x64 /p:DefineConstants="PYTHON27,PYTHON2,UCS4,MONO_LINUX,PYTHON_WITHOUT_ENABLE_SHARED" /p:PythonBuildDir="/tmp/pip-install-LvfpKZ/pythonnet/build/lib.linux-x86_64-2.7" /p:PythonInteropFile="interop27.cs" /verbosity:minimal /t:Build' 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/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-LvfpKZ/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-3FieDl/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.6.2.
    NuGet.exe is up to date.
    MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
    All packages listed in packages.config are already installed.
    
    >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
    
    XBuild Engine Version 14.0
    Mono, Version 5.10.0.160
    Copyright (C) 2005-2013 Various Mono authors
    
    >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
    
    XBuild Engine Version 14.0
    Mono, Version 5.10.0.160
    Copyright (C) 2005-2013 Various Mono authors
    		Configuration: ReleaseMono Platform: x64
    /tmp/pip-install-LvfpKZ/pythonnet/src/runtime/Python.Runtime.csproj: error : Error executing task Copy: Error converting Property named 'SourceFiles' with value '$(TargetAssemblyPdb)' to type Microsoft.Build.Framework.ITaskItem[]: Can't concatenate Item list with other strings where an item list is expected ('@(_OutDirItem->'%(FullPath)')', 'Python.Runtime.pdb'). Use semi colon to separate items.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-LvfpKZ/pythonnet/setup.py", line 405, in <module>
        zip_safe=False,
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions
        self.build_extension(ext)
      File "/tmp/pip-install-LvfpKZ/pythonnet/setup.py", line 222, in build_extension
        subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
      File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'xbuild pythonnet.sln /p:Configuration=ReleaseMono /p:Platform=x64 /p:DefineConstants="PYTHON27,PYTHON2,UCS4,MONO_LINUX,PYTHON_WITHOUT_ENABLE_SHARED" /p:PythonBuildDir="/tmp/pip-install-LvfpKZ/pythonnet/build/lib.linux-x86_64-2.7" /p:PythonInteropFile="interop27.cs" /verbosity:minimal /t:Build' returned non-zero exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-LvfpKZ/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-3FieDl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-LvfpKZ/pythonnet/

What happens this time? Many thanks.

@den-run-ai
Copy link
Contributor

den-run-ai commented Jun 15, 2018 via email

@harryln
Copy link
Author

harryln commented Jun 15, 2018

Hi there,
Just try to install from master branch:

sudo -H pip2 install git+https://github.com/pythonnet/pythonnet
[sudo] password for wl: 
Collecting git+https://github.com/pythonnet/pythonnet
  Cloning https://github.com/pythonnet/pythonnet to /tmp/pip-req-build-MOP0Fa
Building wheels for collected packages: pythonnet
  Running setup.py bdist_wheel for pythonnet ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-MOP0Fa/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-v4nkRE --python-tag cp27:
  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.6.2.
  Update successful.
  MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
  Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
  Restoring NuGet package NUnit.3.7.1.
  Restoring NuGet package UnmanagedExports.1.2.7.
  Adding package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-req-build-MOP0Fa/packages'
  Added package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-req-build-MOP0Fa/packages'
    GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg
    GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/nunit.consolerunner/3.7.0/nunit.consolerunner.3.7.0.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.7.0/nunit.consolerunner.3.7.0.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.7.0/nunit.consolerunner.3.7.0.nupkg
    GET https://api.nuget.org/v3-flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.7.0/nunit.consolerunner.3.7.0.nupkg 467ms
    OK https://api.nuget.org/v3-flatcontainer/nunit.consolerunner/3.7.0/nunit.consolerunner.3.7.0.nupkg 472ms
  Installing NUnit.ConsoleRunner 3.7.0.
  Adding package 'NUnit.ConsoleRunner.3.7.0' to folder '/tmp/pip-req-build-MOP0Fa/packages'
  Added package 'NUnit.ConsoleRunner.3.7.0' to folder '/tmp/pip-req-build-MOP0Fa/packages'
    NotFound https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg 694ms
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg 966ms
  Installing NUnit 3.7.1.
    OK https://api.nuget.org/v3-flatcontainer/nunit/3.7.1/nunit.3.7.1.nupkg 1135ms
  Adding package 'NUnit.3.7.1' to folder '/tmp/pip-req-build-MOP0Fa/packages'
  Added package 'NUnit.3.7.1' to folder '/tmp/pip-req-build-MOP0Fa/packages'
  
  NuGet Config files used:
      /tmp/pip-req-build-MOP0Fa/NuGet.config
      /root/.config/NuGet/NuGet.Config
  
  Feeds used:
      /root/.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
  
  >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
  
  XBuild Engine Version 14.0
  Mono, Version 5.10.0.160
  Copyright (C) 2005-2013 Various Mono authors
  
  >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
  
  XBuild Engine Version 14.0
  Mono, Version 5.10.0.160
  Copyright (C) 2005-2013 Various Mono authors
  		Configuration: ReleaseMono Platform: x64
  delegatemanager.cs(204,13): warning CS0162: Unreachable code detected
  runtime.cs(324,17): warning CS0162: Unreachable code detected
  pythonexception.cs(67,13): warning CS0162: Unreachable code detected
  pyobject.cs(50,13): warning CS0162: Unreachable code detected
  pyscope.cs(534,13): warning CS0162: Unreachable code detected
  Configuration: ReleaseMono Platform: x64
  Configuration: ReleaseMono Platform: x64
  dynamic.cs(121,28): warning CS0618: 'PythonEngine.RunString(string, IntPtr?, IntPtr?)' is obsolete: 'RunString is deprecated and will be removed. Use Exec/Eval/RunSimpleString instead.'
  Configuration: ReleaseMono Platform: x64
  building 'clr' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  creating build/temp.linux-x86_64-2.7/src/monoclr
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/monoclr/pynetinit.c -o build/temp.linux-x86_64-2.7/src/monoclr/pynetinit.o -D_REENTRANT -I/usr/lib/pkgconfig/../../include/mono-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
  In file included from src/monoclr/pynetinit.c:1:0:
  src/monoclr/pynetclr.h:4:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with 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/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-MOP0Fa/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-I3asRn/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 "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-MOP0Fa/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-I3asRn/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-MOP0Fa/

@den-run-ai
Copy link
Contributor

@harryln the error in your build is most likely due to missing dependency (python-dev), please follow travis ci build script to install all dependencies:

src/monoclr/pynetclr.h:4:20: fatal error: Python.h: No such file or directory

@harryln
Copy link
Author

harryln commented Jun 18, 2018

Dear @denfromufa, Many thanks for your reply.

After installingpython-dev by

sudo -H apt install python-dev

I then try again:

sudo -H pip install git+https://github.com/pythonnet/pythonnet     ## pythonnet 2.4.0.dev0

it works.
But:

sudo -H pip install pythonnet       ## pythonnet 2.3.0

still does not work.

One of packages I use needs pythonnet 2.3.0. I wonder whether or not I can install pythonnet 2.3.0 via pip install git+.

Many thanks again for your time.

@den-run-ai
Copy link
Contributor

@harryln you can install pythonnet 2.3 if you install the corresponding Mono version, probably 4.8.0. But I highly recommend the pythonnet master branch (2.4.0.dev1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants