Atom / Pip / Python Language Server


#1

Hello I am trying to learn python using atom. As I am writing my first script everything is fine BUT atom is telling me:

Unable to start Python Language server. Make sure to install pals 0.19 or newer by running…
python -m pip install ‘python-language-server[all]’

My environment is:

atom - 1.13.2
python - 2.7.10
Mac OS - Mojave 10.14

When trying this command I am getting the following error:

Tom$ sudo -H python2.7 -m pip install ‘python-language-server[all]’
Collecting python-language-server[all]
Downloading https://files.pythonhosted.org/packages/9f/1d/2817b5dc2dd77f897410a11c1c9e2a6d96b3273c53d4219dd9edab7882af/python-language-server-0.21.2.tar.gz (51kB)
100% |################################| 61kB 1.4MB/s
Complete output from command python setup.py egg_info:
error in python-language-server setup command: ‘install_requires’ must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in configparser; python_version<“3.0” at ; python_version<“3.0”

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /private/tmp/pip-install-XoKRFw/python-language-server/

Can someone help me clear this error so I can continue? Thank you.


#2

Is there a reason you need sudo for this?

Can someone help me clear this error so I can continue?

If you are still having difficulty installing PyLS after you try it without sudo, you can disable ide-python until you find someone who can help you install the language server on Mac. That will quiet the error.


#3

There is no reason I used sudo just part of trying to make it work on my part. The error is the same with or without sudo.

Hopefully someone can advise how to correct this.


#4

According to the python-language-server docs:

If you get an error similar to ‘install_requires’ must be a string or list of strings then please upgrade setuptools before trying again.

There’s another inconsistency. I don’t know the inner workings of ide-python and don’t have time to investigate now, but I suspect that it likely uses the python command to try to invoke the language server. The command you’re using is for Python 2, specifically. If python points to Python 3, then you should probably install the language server under that command.


#5

Tried adding the version 2.7 to the command with no luck before I posted as that does seem to be the crux of the issue but Atom can’t tell me what needs to be done here. I do appreciate your suggestions.


#6

What happens if you upgrade setuptools?


#7

Thanks for the reply. I checked into the Atom application and in the ‘install packages’ section typing in setuptool does not reveal a package of this name? Are you referring to something else, if so what?

Thank you


#8

If you follow the link I posted and look for the text that I quoted, you will see a command:

pip install -U setuptools

Run this on your system command line to upgrade the setuptools you have installed.


#9

Thank you for the clarification, I ran the command and I don’t think it worked because I got a very long that equally as unclear.

Collecting setuptools

Downloading https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl (569kB)

100% |████████████████████████████████| 573kB 6.7MB/s 

Installing collected packages: setuptools

Found existing installation: setuptools 18.5

Uninstalling setuptools-18.5:

Could not install packages due to an EnvironmentError: [(’/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc’, ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc’, “[Errno 1] Operation not permitted: ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc’”), (’/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py’, ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py’, “[Errno 1] Operation not permitted: ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py’”), (’/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py’, ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py’, “[Errno 1] Operation not permitted: ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py’”), (’/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc’, ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc’, “[Errno 1] Operation not permitted: ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc’”), (’/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib’, ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib’, “[Errno 1] Operation not permitted: ‘/private/var/folders/0s/b4r16hdn0h73qzfp0zp69jgw0000gn/T/pip-uninstall-lLh52d/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib’”)]


#10

I’ve never seen that error before, and based on the error message (it talks about permission and includes a lot of Mac-specific folders like), my best guess is that it’s Mac-related. Sure enough, if I type pip mac operation not permitted into Google, this is the first result. If you use the --user flag to install a package that also exists inside /System/Library/Frameworks/Python.framework/Versions/2.7/, the one in your user folder should take precedence. Here’s some extra reading on how Python locates packages.