Skip to content

Can't install pythonnet with Mono 5 #470

Closed

Description

@phuihock

Environment

  • Pythonnet version: 2.3.0
  • Python version: 2.7.12+
  • Operating System: Ubuntu 16.10

Details

Upgraded Mono from 4.8 to 5.0.0.100 today, can't install pythonnet anymore. Errors thrown during installation. Installation works fine if I revert Mono back to 4.8

  • What commands did you run to trigger this issue?
    pip install --upgrade pythonnet==2.3.0
  • If there was a crash, please include the traceback here.
    XBuild Engine Version 14.0
    Mono, Version 5.0.0.0
    Copyright (C) 2005-2013 Various Mono authors
    		Configuration: ReleaseMono Platform: x64
    /tmp/pip-build-8dGdQm/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-build-8dGdQm/pythonnet/setup.py", line 405, in <module>
        zip_safe=False,
      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 "/home/phuihock/Work/mono5/env/local/lib/python2.7/site-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-build-8dGdQm/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-build-8dGdQm/pythonnet/build/lib.linux-x86_64-2.7" /p:PythonInteropFile="interop27.cs" /verbosity:minimal /t:Build' returned non-zero exit status 1
    
    ----------------------------------------
Command "/home/phuihock/Work/mono5/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8dGdQm/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-PVMfSd-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/phuihock/Work/mono5/env/include/site/python2.7/pythonnet" failed with error code 1 in /tmp/pip-build-8dGdQm/pythonnet/

If there is any other log/command output I should include, please advice.

Activity

  1. den-run-ai commented on May 23, 2017

    @den-run-ai
    Contributor

    Thanks for trying out pythonnet, this is already tracked here:

    #464
    #471

  2. mikofski commented on Nov 20, 2017

    @mikofski

    Hi All, love PythonNET, great software, thanks so much! For anyone still struggling with this, the fix, as mentioned in several issues is to use the latest master to build your own wheel:

    $ brew install pkg-config
    $ brew cask install mono-mdk
    $ locate mono-2.pc
    $ git clone https://github.com/pythonnet/pythonnet
    $ cd pythonnet/
    $ PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/pkgconfig/ python setup.py bdist_wheel
    $ pip install --user dist/pythonnet-2.4.0.dev0-cp27-cp27m-macosx_10_13_intel.whl 
    

    system

    • mono-mdk: 5.4.1
    • osx: high sierra
    • python: 2.7.10
    • pythonnet: 2.4.0.dev0

    NB you will need pkg-config, which you can get from homebrew

  3. den-run-ai commented on Nov 20, 2017

    @den-run-ai
    Contributor

    @mikofski what is brew cask install mono-mdk doing? Do you think we should update the OSX notes here:

    https://github.com/pythonnet/pythonnet/wiki/Troubleshooting-on-Windows,-Linux,-and-OSX#osx-notes

  4. mikofski commented on Nov 20, 2017

    @mikofski

    @denfromufa currently, homebrew has two versions of mono, which are incompatible:

    The cask is basically the latest version of the mono package from Xamarin. Since it's a Cask, it installs as a System Framework, instead of building from scratch into /usr/local. Versions of nuget, xbuild, msbuild, etc. are all located in the System Framework instead of /usr/local/bin, so you have to unlink the older Homebrew mono if you want to use the newer one and vice versa. If you ask Homebrew Cask for info, you get this caveat:

    $ brew cask info mono-mdk
    
    Installing mono-mdk removes mono and mono dependent formula binaries in
    /usr/local/bin and adds mono-mdk to /private/etc/paths.d/
    You may want to:
    
      brew unlink {formula} && brew link {formula}
    
    and/or remove /private/etc/paths.d/mono-commands
    

    I personally prefer the newer one. Perhaps the two options can both be mentioned in the wiki, and then the user can choose.

  5. AaronScruggs commented on Jan 19, 2018

    @AaronScruggs

    @mikofski Thank you so much for those instructions! I have tried countless other solutions and yours was the only one that worked.

  6. mikofski commented on Jan 23, 2018

    @mikofski

    FYI: after my latest brew update both the cask and the bottle are the same version, v5.4.1.6

  7. saleph commented on May 15, 2018

    @saleph

    I had a big issues with installation. In my case the solution was:

    $ pip install git+https://github.com/pythonnet/pythonnet --user
    

    for Mono 5.10. Remember to rm -r ~/.cache/pip after previous attempts.

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