Skip to content

latest master cannot be installed with pip+git #555

Closed

Description

@den-run-ai
C:\Windows\system32>pip install git+https://github.com/pythonnet/pythonnet
Collecting git+https://github.com/pythonnet/pythonnet
  Cloning https://github.com/pythonnet/pythonnet to c:\users\denis~1.akh\appdata\local\temp\pip-so1nbo-build
  Requirement already satisfied (use --upgrade to upgrade): pythonnet==2.4.0.dev0 from git+https://github.com/pythonnet/pythonnet in c:\python\python27-32\lib\site-packages

C:\Windows\system32>pip install git+https://github.com/pythonnet/pythonnet -U
Collecting git+https://github.com/pythonnet/pythonnet
  Cloning https://github.com/pythonnet/pythonnet to c:\users\denis~1.akh\appdata\local\temp\pip-ytahwe-build
Installing collected packages: pythonnet
  Found existing installation: pythonnet 2.4.0.dev0
    Uninstalling pythonnet-2.4.0.dev0:
      Successfully uninstalled pythonnet-2.4.0.dev0
  Running setup.py install for pythonnet ... error
    Complete output from command c:\python\python27-32\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\denis~1.akh\\appdata\\local\\temp\\pip-ytahwe-build\\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\denis~1.akh\appdata\local\temp\pip-3dupcl-record\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

    ----------------------------------------
  Rolling back uninstall of pythonnet
Command "c:\python\python27-32\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\denis~1.akh\\appdata\\local\\temp\\pip-ytahwe-build\\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\denis~1.akh\appdata\local\temp\pip-3dupcl-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\denis~1.akh\appdata\local\temp\pip-ytahwe-build\

Activity

  1. vkhombal commented on Oct 18, 2017

    @vkhombal

    I have the same problem

    MAC:~ vh$ USE_OSX_FRAMEWORKS=0 ARCHFLAGS="-arch x86_64" pip install git+https://github.com/pythonnet/pythonnet
    Collecting git+https://github.com/pythonnet/pythonnet
      Cloning https://github.com/pythonnet/pythonnet to /private/var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-k0mwha74-build
    Installing collected packages: pythonnet
      Running setup.py install for pythonnet ... error
        Complete output from command /Users/vh/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-k0mwha74-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-rdu2fvtq-record/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 "/Users/vh/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-k0mwha74-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-rdu2fvtq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rr/czhl9xgd6r570kqjb_4p6lnc0000gn/T/pip-k0mwha74-build/
    
  2. den-run-ai commented on Oct 18, 2017

    @den-run-ai
    ContributorAuthor
  3. vkhombal commented on Oct 19, 2017

    @vkhombal

    hi, thanks.
    hi, i tried

    python setup.py bdist_wheel --xplat

    this gives

    File "setup.py", line 311, in _install_packages
       subprocess.check_call(cmd, shell=use_shell)
     File "/Users/vh/anaconda/lib/python3.5/subprocess.py", line 581, in check_call
       raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'dotnet msbuild /t:Restore pythonnet.15.sln /p:Configuration=ReleaseMono /p:Platform=x64' returned non-zero exit status 127
    

    PS: I'm trying this on OSX

  4. den-run-ai commented on Oct 19, 2017

    @den-run-ai
    ContributorAuthor

    Remove --xplat to use Mono instead of .NET Core.

  5. den-run-ai commented on Oct 24, 2017

    @den-run-ai
    ContributorAuthor

    Related, thanks to @dmitriyse and @hjaekel for the deprecated --egg temp workaround:

    #562 (comment)

  6. vkhombal commented on Oct 24, 2017

    @vkhombal

    On OSX for the following worked.

    brew install pkg-config
    brew install glib --universal
    brew install mono
    
    export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig
    export DYLD_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib
    
    cd anaconda/lib
    ln -s /Library/Frameworks/Mono.framework/Versions/Current/lib/mono
    
    python setup.py bdist_wheel
    pip install --no-index --find-links=./dist/ pythonnet
    

    Thank you @denfromufa

  7. den-run-ai commented on Oct 24, 2017

    @den-run-ai
    ContributorAuthor

    @vkhombal don't forget to star the repo :)

    I added the link to your instructions for mac here:

    #465

  8. nsbruce commented on Nov 6, 2017

    @nsbruce

    Pitching in here, I've been trying to get pythonnet installed for a few days on macOS 10.13.1 with no luck. I've tried all of the work-arounds and solutions which I've found between here and #465.

    Obvious differences between setups like @vkhombal's and mine is that I'm using MacPorts instead of Homebrew, and that since the port install mono installs an older version, I build from the .pkg at mono-project.com (so I'm running v5.4.0).

    From above, python setup.py bdist_wheel fails with
    subprocess.CalledProcessError: Command 'pkg-config --libs mono-2' returned non-zero exit status 1

    Any advice is appreciated. I've starred the repo and will update if I figure anything out.

  9. den-run-ai commented on Nov 7, 2017

    @den-run-ai
    ContributorAuthor

    @nsbruce more detailed error would be really helpful, but my understanding is that macports is a lot less used than homebrew and so we cannot support yet another scenario.

    Also please provide versions for all dependencies.

  10. nsbruce commented on Nov 8, 2017

    @nsbruce

    Dependency versions:

    > pkg-config --version
    0.29.2
    
    > mono --version
    Mono JIT compiler version 5.4.0.201 (2017-06/71277e78f6e Thu Sep 21 19:22:55 EDT 2017)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    	TLS:           normal
    	SIGSEGV:       altstack
    	Notification:  kqueue
    	Architecture:  amd64
    	Disabled:      none
    	Misc:          softdebug
    	LLVM:          yes(3.6.0svn-mono-master/8b1520c8aae)
    	GC:            sgen (concurrent by default)
    
    > port info glib2
    glib2 @2.54.2 (devel)
    Variants:                       quartz, universal, [+]x11
    
    Description:                  Glib is a library which includes support routines for C,
                                          such as lists, trees, hashes, memory allocation, and many
                                          other things.
    Homepage:                   https://wiki.gnome.org/Projects/GLib
    
    Extract Dependencies: xz
    Build Dependencies:    libxml2
    Library Dependencies: gettext, libffi, libiconv, pcre, zlib
    Conflicts with:              glib2-devel
    Platforms:                     darwin
    License:                        LGPL-2+
    Maintainers:                 Email: ryandesign@macports.org, GitHub: ryandesign
                                          Policy: openmaintainer
    
    > python --version
    Python 2.7.14
    

    When I run sudo python setup.py bdist_wheel (without sudo it doesn't run):

    sudo python setup.py bdist_wheel
    Password:
    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.3.0.
    Update successful.
    MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/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.ConsoleRunner.3.7.0' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    Adding package 'UnmanagedExports.1.2.7' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    Adding package 'NUnit.3.7.1' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    Added package 'UnmanagedExports.1.2.7' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    Added package 'NUnit.ConsoleRunner.3.7.0' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    Added package 'NUnit.3.7.1' to folder '/Users/nsbruce-school/Downloads/pythonnet-master/packages'
    
    NuGet Config files used:
        /Users/nsbruce-school/Downloads/pythonnet-master/nuget.config
        /Users/nsbruce-school/.config/NuGet/NuGet.Config
    
    Feeds used:
        /Users/nsbruce-school/.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.4.0.0
    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.4.0.0
    Copyright (C) 2005-2013 Various Mono authors
    		Configuration: ReleaseMono Platform: x64
    delegatemanager.cs(204,13): warning CS0162: Unreachable code detected
    runtime.cs(327,17): warning CS0162: Unreachable code detected
    pythonexception.cs(64,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
    Package mono-2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `mono-2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'mono-2' found
    Traceback (most recent call last):
      File "setup.py", line 522, in <module>
        zip_safe=False,
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setup.py", line 470, in run
        return bdist_wheel.bdist_wheel.run(self)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 204, in run
        self.run_command('build')
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
        self.run_command(cmd_name)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 449, in build_extensions
        self.build_extension(ext)
      File "setup.py", line 270, in build_extension
        self._build_monoclr()
      File "setup.py", line 284, in _build_monoclr
        mono_libs = _check_output("pkg-config --libs mono-2", shell=True)
      File "setup.py", line 98, in _check_output
        output = subprocess.check_output(*args, **kwargs)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command 'pkg-config --libs mono-2' returned non-zero exit status 1
    
  11. nsbruce commented on Nov 8, 2017

    @nsbruce

    I've found mono-2.pc at /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig/mono-2.pc

    I tried to link it into /local/lib with:

    > cd /usr/local/lib/pkgconfig/
    >sudo ln -s /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig/mono-2.pc
    

    But I see the same error,

    Package mono-2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `mono-2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'mono-2' found
    

    I thought that export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig would definitely do it, but no.

    Something funky is going on. The above doesn't make sense to me. I'll update this comment as I go.

    I'm trying to force mono-2 into the path but there must be an issue with the order of my PATH variable? Similar issue

    Currently, for me:

    > echo $PKG_CONFIG_PATH
    /usr/local/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
    
  12. den-run-ai commented on Nov 8, 2017

    @den-run-ai
    ContributorAuthor

    @nsbruce please downgrade to mono 5.2, there is a bug with mono 5.4, it fails few tests.

  13. nsbruce commented on Nov 8, 2017

    @nsbruce

    @denfromufa same error at 5.2.0.224

  14. den-run-ai commented on Nov 10, 2017

    @den-run-ai
    ContributorAuthor

    @nsbruce like I mentioned, macports is not supported scenario for pythonnet and mono. please move your comments from this issue to a new issue with title about macports and osx. someone may have done this before:

    https://mail.python.org/pipermail/pythondotnet/2013-June/001383.html

  15. den-run-ai commented on Jan 28, 2018

    @den-run-ai
    ContributorAuthor

    Side effect of this --egg installation option is that pip uninstall pythonnet does not remove the files correctly:

    :\Python\pythonnet\pythonnet>pip uninstall pythonnet
    Uninstalling pythonnet-2.4.0.dev0:
      c:\python\python35_64b\lib\site-packages\pythonnet-2.4.0.dev0-py3.5.egg-info
    Proceed (y/n)? y
      Successfully uninstalled pythonnet-2.4.0.dev0
    

    Python.Runtime.dll and clr.pyd are left in place.

  16. den-run-ai commented on May 29, 2018

    @den-run-ai
    ContributorAuthor

    somehow this is now fixed with latest pip:

    image

  17. eric-appion commented on Feb 21, 2020

    @eric-appion

    I'm using Python 3.8.1 with pip 20.0.2 on Windows 10, and when I do a "pip install pythonnet", I still get --single-version-externally-managed not recognized.

  18. cnaccio commented on Oct 1, 2020

    @cnaccio

    Running Python 3.8.5 with Mono 6.10.0 on OSX Catalina, as able to get pip install pythonnet by setting a PKG_CONFIG_PATH as below. Hope this helps!

    export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig

  19. sorenwacker commented on Jan 19, 2021

    @sorenwacker

    This path does not seem to exist on Linux systems. Is there an alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions