For some reason, I run into this issue when trying to install pylint versions > 2.0 in Docker (earlier version work).
FROM node:argon
RUN ["adduser", "--home", "/usr/src/app", "--system", "sandboxuser"]
RUN ["chown", "-R", "sandboxuser", "/usr/src/app"]
RUN ["chmod", "-R", "u+rwx", "/usr/src/app"]
COPY ./shared /usr/src/app
RUN cd /usr/src/app && npm install
COPY start.sh /
RUN chmod 755 /start.sh
RUN apt-get update
# Install python 3
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install pylint==1.9
CMD ["/start.sh"]
docker build -t testing ....
Step 11/12 : RUN pip3 install pylint
---> Running in 79ce94f5a7e4
Downloading/unpacking pylint
Downloading/unpacking astroid>=2.0.0 (from pylint)
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2595, in _dep_map
return self.__dep_map
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2457, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1266, in prepare_files
req_to_install.extras):
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2401, in requires
dm = self._dep_map
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2597, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2630, in _compute_dependencies
common = frozenset(reqs_for_extra(None))
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2627, in reqs_for_extra
if req.marker_fn(override={'extra':extra}):
File "/usr/lib/python3/dist-packages/_markerlib/markers.py", line 113, in marker_fn
return eval(compiled_marker, environment)
File "<environment marker>", line 1, in <module>
NameError: name 'implementation_name' is not defined
Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c pip3 install pylint' returned a non-zero code: 2
Step 11/12 : RUN pip3 install pylint
---> Running in 79ce94f5a7e4
Downloading/unpacking pylint
Downloading/unpacking astroid>=2.0.0 (from pylint)
...
Successfully installed pylint
...
Not sure if this has to do with me. When I change it to an earlier version in my Dockerfile, it works:
RUN pip3 install pylint==1.9
Not exactly sure why...
Related issue for reference: https://github.com/PyCQA/pylint/issues/2291
@ethanchewy This is caused by our use of environment markers in astroid: https://github.com/PyCQA/astroid/blob/master/astroid/__pkginfo__.py#L33. I managed to reproduce this error using your Dockerfile, thanks for providing that! The problem is that your container uses an old version of setuptools that doesn't know how to handle environment markers correctly, if you do a pip3 install setuptools -U before installing pylint, that should solve this problem for you.
Hi @PCManticore , I'm encountering the same issue using Python 3.5.2, while trying to install pylint==2.4.2. Running pip3 install setuptools -U doesn't solve the issue, do you have any suggestion on next steps I could try? Thanks
Edit: Also running simply pip install pylint fails with the same error
Most helpful comment
@ethanchewy This is caused by our use of environment markers in astroid: https://github.com/PyCQA/astroid/blob/master/astroid/__pkginfo__.py#L33. I managed to reproduce this error using your Dockerfile, thanks for providing that! The problem is that your container uses an old version of
setuptoolsthat doesn't know how to handle environment markers correctly, if you do apip3 install setuptools -Ubefore installingpylint, that should solve this problem for you.