i was able to fix that when i saw it yesterday by ...
# general
a
i was able to fix that when i saw it yesterday by running
pip3 install setuptools==40.0.0
, which i didn't try to push a fix for because i thought it was isolated to the environment i was in, and it was running pants from source -- could you let me know if that does anything?
f
Copy code
alexis@alexis   master ●  pip3 install setuptools==40.0.0
Collecting setuptools==40.0.0
  Cache entry deserialization failed, entry ignored
  Downloading <https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl> (567kB)
    100% |████████████████████████████████| 573kB 2.2MB/s
Installing collected packages: setuptools
Successfully installed setuptools-40.0.0
 alexis@alexis  master ●  ./pants ng-killall
Traceback (most recent call last):
  File "/home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/virtualenv-16.4.3/virtualenv.py", line 22, in <module>
    import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
./pants: line 170: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/pants.90NBRR/install/bin/pip: No such file or directory
./pants: line 171: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/pants.90NBRR/install/bin/pip: No such file or directory
New virtual environment successfully created at /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/1.15.0_py36.
./pants: line 193: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/1.15.0_py36/bin/python: No such file or directory
a
agh! sorry
❤️ 1
did this start immediately upon upgrade?
f
yes
a
could you let me know what the output is if you run:
Copy code
> rm -rf ~/.cache/pants/setup
> PEX_VERBOSE=9 ./pants ... (whatever pants command you were running just now)
f
Copy code
PEX_VERBOSE=9 ./pants ng-killall
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   122  100   122    0     0    231      0 --:--:-- --:--:-- --:--:--   231
100   281  100   281    0     0    417      0 --:--:-- --:--:-- --:--:--   417
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 3626k  100 3626k    0     0  2841k      0  0:00:01  0:00:01 --:--:-- 36.0M
Traceback (most recent call last):
  File "/home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/virtualenv-16.4.3/virtualenv.py", line 22, in <module>
    import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
./pants: line 170: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/pants.1sNjRg/install/bin/pip: No such file or directory
./pants: line 171: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/pants.1sNjRg/install/bin/pip: No such file or directory
New virtual environment successfully created at /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/1.15.0_py36.
./pants: line 193: /home/alexis/.cache/pants/setup/bootstrap-Linux-x86_64/1.15.0_py36/bin/python: No such file or directory
w
how old is your
pants
script?
you should likely recreate it using https://www.pantsbuild.org/install.html#recommended-installation if you haven't updated it in a while
but also, i would not suggest using
dev
versions in general. would stick to either
rcs
or final versions.
f
My script is the updated 🙂 . Also we run the
1.15.0
version. It's just I tracked the issue back to the
1.15.0.dev0
version
h
Hi @flaky-photographer-75744, one potential thing to try. Can you please add to your
pants.ini
under the section
GLOBAL
the entry
pants_runtime_python_version: 2.7
? This is a deprecated option that will tell Pants to run the tool with Python 2.7 (different than what is used to run your actual code / tests). Right now, it looks like it’s using Python 3.6.
f
It works indeed ! Thank you
h
Yay! Although it should be working with Py36 too. I’ll investigate.
Hm I think I found the issue. https://doc.dataiku.com/dss/latest/code-envs/troubleshooting.html#creation-of-code-environments-fails-with-no-module-named-distutils-spawn @flaky-photographer-75744 could you please try out
apt-get install python3-distutils
, remove the
pants_runtime_python_version
line, and try to run
./pants
? No worries if you can’t install things like that in your environment.
f
The error stays still
I must admit I played with my python distributions to try fixing this problem though. Maybe there is some issuesthere.
Last but not least, recently I had to use the
Copy code
[python-setup]
interpreter_constraints: ["CPython==2.7.*,<3"]
option to fix the compile goal which results in the following error otherwise:
Copy code
10:47:10 00:01     [conan-prep]**** Failed to install setuptools-40.4.3 (caused by: NonZeroExit("received exit code 1 during execution of `['/usr/bin/python3.6', '-', 'bdist_egg', '--dist-dir=/tmp/tmpLsVFAN']` while trying to execute `['/usr/bin/python3.6', '-', 'bdist_egg', '--dist-dir=/tmp/tmpLsVFAN']`",)
):
stdout:

stderr:
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils.core'
So the two problems may be related. I can't refer to the previous discussion I had on this slack (messages are now hidden)
@hundreds-father-404 any new insights about this issue ?
h
How did you play with your python distributions?
f
what do you mean ? The only "weird" thing I see with my python distribution is that I have python3.6 and python3.7 both on my computer
h
Hey @flaky-photographer-75744, I’ve been researching this more and from everything I can tell, your installed Python doesn’t have
distutils
installed, which is what’s causing this error. Everyone recommends fixing it via
apt-get install python3-distutils
. I know that didn’t work last time - I’m wondering what was the output when you ran
apt-get install python3-distutils
? Could you also try this for me please?
python3.6 -c 'import distutils'
and the same with
python3.7
f
I found something
I can import distutils both from python3.6 and python3.7. However when running
virtualenv venv --python=python3.6
i run into File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 25, in <module> import distutils.spawn ModuleNotFoundError: No module named 'distutils.spawn' and not when running
virtualenv venv --python=python3.7
So I managed to make things work at the end uninstalling virtualenv (both from pip and apt) and reinstalling. An apt autoremove might have also helped. Sorry for the disagreement ! And thanks a lot for your wonderful support
h
Yay! That’s great to hear! You’re welcome, glad this got resolved as running Pants with Python 3 is much faster and we are very soon going to remove support for running it with python 2