Closed abhinavsp0730 closed 3 years ago
I've no idea what that "pyenv-pip-rehash" plugin is. https://github.com/pyenv/pyenv-pip-rehash#readme says it's no longer needed.
It says we don't need to install this plugin anymore. It comes with pyenv-virtualenv
I'm getting the same error, but with the included pip-rehash
:
/home/username/.pyenv/pyenv.d/exec/pip-rehash/pip: line 20: 43331 Segmentation fault (core dumped) "$PYENV_COMMAND_PATH" "$@"
Somehow I managed to fix it by not providing a name for the virtualenv I'm creating.
So this ends up with pip/python mismatch and seg.fault:
pyenv virtualenv -f 3.6.15 env_name
But this one works:
pyenv virtualenv -f 3.6.15
Not sure if -f
helps or not, I stopped experimenting after solving my problem.
Edit: I was wrong, when I don't provide a name, it incorrectly creates the environment using Python 3.10 then the pip matches with the python.
@evrenesat From your dump, I can only see that /home/evren/.pyenv/versions/eiq/bin/pip3.6
segfaults.
I believe only analyzing the core (that is going to need debugging info for relevant modules) or running the underlying Python with diagnostics can give any more information. E.g. it's possible that a binary-incompatible dynamic lib is being loaded.
The issue only happens on Ubuntu 21.10. After I spend a day, I gave up and installed 20.04 then everything worked perfectly. For another reason I reinstalled 21.10 again, segmentation faults came back. Each time it was a clean install.
It's happening on manjaro.
On Sat, Oct 23, 2021, 5:55 PM Evren Esat Özkan @.***> wrote:
The issue only happens on Ubuntu 21.10. After I spend a day, I have gave up and installed 20.04 then everything worked perfectly. For another reason I reinstalled 21.10 again, segmentation faults came back. Each time it was a clean install.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pyenv/pyenv-virtualenv/issues/410#issuecomment-950144898, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKM6BK7KP3OMKI52SEW77I3UIKSSNANCNFSM5FHLKTVQ .
The issue only happens on Ubuntu 21.10.
Does it also happen in a 21.10 docker container? Can you provide reproduction steps from a clean state?
I have this on Fedora 35 Beta with Python 3.6.15
If you create the venv without a name it works fine as the previous comment said:
pyenv virtualenv -f 3.6.15
In Ubuntu 21.10, I downloaded Python 3.6.15 from python.org, manually compiled and installed. It was enough to run "import ctypes" in python shell to crash it with seg. fault. That's also why pip was crashing. So, it doesn't seem to be related with pyenv.
Tried same steps in a Docker container on a Ubuntu 20.04 host but it didn't crash.
I have found a working temporary fix from this french site
to fix the issue you can comment this line in the file /home/johackim/.pyenv/versions/3.7.0/bin/pip3.7
# sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
Tried with venv, virtualenv, pyenv-virtualenv in my Ubuntu 21.10, and always the same seg fault error at the end of some installation process. I agree with @evrenesat. Installing an older Ubuntu.
stil happen in ubuntu 22.04 (default python3.10) and pyenv 2.2.5 and latest pyenv-virtualenv !
first time every thing ok.
pyenv virtualenv -f 3.6.9 pyenv-3.6.9
pyenv activate pyenv-3.6.9
pip install mysqlclient==2.0.3
out and go into again jsut justdump
pyenv virtualenv -f 3.6.9 pyenv-3.6.9
pyenv activate pyenv-3.6.9
pip list
/home/wilson/local/pyenv/pyenv.d/exec/pip-rehash/pip:line 20: 2975264 coredump .....xxx. "$PYENV_COMMAND_PATH" "$@"
Needed to upgrade python version to 3.8.13 to surpass this error. I guess it might be related to pip version used in python 3.6.x (pip-21.3.1). When changed to python 3.8.13 (and pip-22.0.4) the issues after installing any modules was solved.
I'm using Pop OS! 22.04 LTS
There is a solution (tested on ubuntu 22.04):
cat alignment.patch
--- Include/objimpl.h
+++ Include/objimpl.h
@@ -250,7 +250,7 @@
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;
--- Objects/obmalloc.c
+++ Objects/obmalloc.c
@@ -643,8 +643,8 @@
*
* You shouldn't change this unless you know what you are doing.
*/
-#define ALIGNMENT 8 /* must be 2^N */
-#define ALIGNMENT_SHIFT 3
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
pyenv install --patch 3.6.8 < alignment.patch
in Ubuntu 22. i had to install gcc-10 then CC=gcc-10 pyenv install 3.6.13
https://giters.com/pyenv/pyenv/issues/1889
This worked for me aswell.
Worked for me using pyenv, WSL debian testing branch as well.
Solution:
$ sudo apt install clang -y
$ CC=clang pyenv install 3.6.15
Ubuntu 22.04 pyenv 3.6.15 (global)
So I tried a number of things that didn't work, then simply:
$ sudo apt-get install --reinstall pip
I'm getting the same error, but with the included
pip-rehash
:/home/username/.pyenv/pyenv.d/exec/pip-rehash/pip: line 20: 43331 Segmentation fault (core dumped) "$PYENV_COMMAND_PATH" "$@"
~Somehow I managed to fix it~ by not providing a name for the virtualenv I'm creating. So this ends up with pip/python mismatch and seg.fault:
pyenv virtualenv -f 3.6.15 env_name
But this one works:
pyenv virtualenv -f 3.6.15
Not sure if
-f
helps or not, I stopped experimenting after solving my problem.Edit: I was wrong, when I don't provide a name, it incorrectly creates the environment using Python 3.10 then the pip matches with the python.
click to see the debug output, in case if it helps
The reason for installing Pyenv
in the first place is to have multiple python versions and virtualenv, so that we can switch between them robustly.
This solution does not create a new virtualenv but instead creates another python instance. If we then install the dependencies on that, we would pollute the global env so that we cannot use this instance across multiple different projects.
The above solution by @kolypto to use clang
instead of gcc
for compiling & installing different python versions works and looks like the best solution for me.
https://github.com/pyenv/pyenv/pull/2630 has likely fixed this for 3.5.10 and 3.6.15. It's an upstream problem that was fixed in 3.7+. Since the former are EOL, they didn't backport that patch further.
Solution:
$ sudo apt install clang -y $ CC=clang pyenv install 3.6.15
in case you are using fedora:
sudo dnf install clang
CC=clang pyenv install 3.6.13
Solution:
$ sudo apt install clang -y $ CC=clang pyenv install 3.6.15
in case you are using fedora:
sudo dnf install clang CC=clang pyenv install 3.6.13
lifesaver
while using any pip command I'm getting
@native-api any help?