Skip to content
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

Issues installing slycot via pip #74

Closed
atomoclast opened this issue Aug 8, 2019 · 10 comments
Closed

Issues installing slycot via pip #74

atomoclast opened this issue Aug 8, 2019 · 10 comments

Comments

@atomoclast
Copy link

Hello,

Currently trying to install slycot in conjunction with control.

No issues installing the control library in both Python2 and Python3.

While running sudo pip[3] install slycot, I get the following output:

Collecting slycot
  Using cached https://files.pythonhosted.org/packages/ae/9d/7ed3f2abf08aab0be9ac2b67e3040c20d9c594cce6a4af2203da0c28a6c4/slycot-0.3.5.0.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpuby90lub
       cwd: /tmp/pip-install-4y2kxn4y/slycot
  Complete output (10 lines):
  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
      main()
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 48, in get_requires_for_build_wheel
      backend = _build_backend()
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 39, in _build_backend
      obj = getattr(obj, path_part)
  AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpuby90lub Check the logs for full command output.

I'd really like to know if this is a local issue and how to resolve it because I'm having issues using the main controls library because of errors related to needing slycot:

/usr/local/lib/python3.5/dist-packages/control/statefbk.py in lqr(*args, **keywords)
    313         from slycot import sb02mt
    314     except ImportError:
--> 315         raise ControlSlycot("can't find slycot module 'sb02md' or 'sb02nt'")
    316 
    317     #

ControlSlycot: can't find slycot module 'sb02md' or 'sb02nt'

Thanks!

@moorepants
Copy link
Contributor

Maybe this helps: pypa/setuptools#1694

@atomoclast
Copy link
Author

Thanks for the link.

I tried looking through it, but I'm not using a venv of any sort to get it setup...
I don't have a pyproject.toml file in my environment as a result.

@moorepants
Copy link
Contributor

Ok, good to know.

@murrayrm murrayrm transferred this issue from python-control/python-control Aug 9, 2019
@murrayrm
Copy link
Member

murrayrm commented Aug 9, 2019

@atomoclast: moved this over to slycot since that seems most relevant for this issue.

@bnavigator
Copy link
Collaborator

Have you also looked at pypa/pip#6264 ? Maybe --no-use-pep517 helps in your setup, too.

Also the pyproject.toml mentioned would be the one of slycot. You could try manually downloading the package (or clone the repository), modify the file to contain build-backend="setuptools.build_meta" and use pip to install the local package.

@roryyorke
Copy link
Collaborator

Slycot is unfortunately tricky to install from source, even from pip. What OS (including version) are you using?

I recommend using conda, and if you can't, to use a virtual environment. I don't think any of the developers use sudo pip install slycot.

One thing that occurs to me is that your pip might be out of date. pip install -U pip fixes that, but I suspect that isn't a great idea when used with sudo.

@bnavigator should we have build-backend="setuptools.build_meta" in pyproject.toml (or somewhere else?)

@bnavigator
Copy link
Collaborator

One thing that occurs to me is that your pip might be out of date. pip install -U pip fixes that, but I suspect that isn't a great idea when used with sudo.

Could also be setuptools being out of date. __legacy__ was only renamed 6 months ago. From the use of sudo and Python version being 3.5, I suspect @atomoclast uses Ubunut 16.04. Quite old.

Python packaging is a nightmare (see xkcd 1987) and using pip system wide with sudo is a common cause for inconsistencies. Use your distro's package manager or if the package is not available use pip as user, possibly in a venv, but avoid sudo. Conda is another option.

@bnavigator should we have build-backend="setuptools.build_meta" in pyproject.toml (or somewhere else?)

From my experiment with opensuse build service it does not hurt at least. Next try would be a run with CI here.

Let's first see if it actually helps in @atomoclast's setup.

@atomoclast
Copy link
Author

I'm using Ubuntu 16.04 right now. I can try to set-up a virtual env on my laptop and try a pip install then.

I don't want to use conda, because it mucks (granted, there are ways to tweak it) with some of the other local virtual environments we have for the host OS as well as the build system we use and such.

Maybe a clean virtual environment is the best way to keep it compartmentalized. :)

@bnavigator
Copy link
Collaborator

bnavigator commented Aug 10, 2019

I don't want to use conda, because it mucks (granted, there are ways to tweak it) with some of the other local virtual environments we have for the host OS as well as the build system we use and such.

Sounds like it's more a problem of your setup than of slycot. (Did I mention that xkcd already?)

Have you tried the build-backend line or the --no-use-pep517 option already? Also to reiterate, check the setuptools and pip versions you are using.

@roryyorke
Copy link
Collaborator

This was fixed in #67, released in 0.3.5; here's a pip install slycot result in a Python 3 virtual environment on my Ubuntu 18.04 system:

$ pip install --no-cache-dir slycot
Collecting slycot
  Downloading slycot-0.3.5.0.tar.gz (1.5 MB)
     |████████████████████████████████| 1.5 MB 1.2 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting numpy
  Downloading numpy-1.18.2-cp36-cp36m-manylinux1_x86_64.whl (20.2 MB)
     |████████████████████████████████| 20.2 MB 1.1 MB/s 
Building wheels for collected packages: slycot
  Building wheel for slycot (PEP 517) ... done
  Created wheel for slycot: filename=slycot-0.3.5-cp36-cp36m-linux_x86_64.whl size=1413037 sha256=0732abc62f12cd78d52086da2a2362222475e88d36c86525d7ee38d3491e5711
  Stored in directory: /tmp/pip-ephem-wheel-cache-8eupuhx_/wheels/06/53/e1/177120b952cb923a121d3008686503deff7c1fbaececf7d519
Successfully built slycot
Installing collected packages: numpy, slycot
Successfully installed numpy-1.18.2 slycot-0.3.5

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

5 participants