Bug 32211 - pyvenv in python3 fails
Summary: pyvenv in python3 fails
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: python3 (show other bugs)
Version: unstable
Hardware: all Linux
: P3 major
Assignee: Grigory Ustinov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks: 32205
  Show dependency tree
 
Reported: 2016-06-22 15:48 MSK by Ivan Zakharyaschev
Modified: 2019-04-18 18:54 MSK (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2016-06-22 15:48:04 MSK
python3-3.5.1-alt7

https://bugzilla.altlinux.org/show_bug.cgi?id=32205#c2 :

pyvenv тоже не рабочий.

$ pyvenv-3.5 .
Error: Command '['/home/cow/test/python/bin/python3.5', '-Im', 'ensurepip',
'--upgrade', '--default-pip']' returned non-zero exit status 1
[cow@localhost python]$ /home/cow/test/python/bin/python3.5 -Im ensurepip
--upgrade --default-pip
Traceback (most recent call last):
  File "/usr/lib64/python3.5/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib64/python3.5/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/usr/lib64/python3.5/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/usr/lib64/python3.5/ensurepip/__init__.py", line 98, in bootstrap
    "_bundled/{}".format(wheel_name),
  File "/usr/lib64/python3.5/pkgutil.py", line 629, in get_data
    return loader.get_data(resource_name)
  File "<frozen importlib._bootstrap_external>", line 815, in get_data
FileNotFoundError: [Errno 2] No such file or directory:
'/usr/lib64/python3.5/ensurepip/_bundled/setuptools-18.2-py2.py3-none-any.whl'

+++ This bug was initially created as a clone of Bug #32205 +++

1. Установлен starterkit с LXDE на борту. Для справки:
$ uname -r
4.4.13-std-def-alt0.M80P.1

$ cat /etc/redhat-release 
ALT Linux starter kit (Hypericum)

$ rpm -qa | grep python3-module-virtualenv
python3-module-virtualenv-13.1.0-alt1.1

2. Создаю виртуальное окружение:
$ virtualenv3 myvenv
Using base prefix '/usr'
New python executable in myvenv/bin/python3
Also creating executable in myvenv/bin/python
Installing setuptools, pip, wheel...done.

3. Активирую его:
$ source myvenv/bin/activate
(myvenv)[sadmin@comp-celeron-cpu-919525 ~]$ 

4. Обновляю pip:
$ pip install --upgrade pip
Traceback (most recent call last):
  File "/home/sadmin/myvenv/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named 'pip'

5. Устанавливаю произвольный пакет:
$ pip install mutagen==1.29
Traceback (most recent call last):
  File "/home/sadmin/myvenv/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named 'pip'

И в качестве дополнения. В p8 третий Питон имеет версию 3.5.1, а это предполагает наличие стандартного модуля для создания виртуального окружения и работы с ним. Так вот этот модуль отпинывает попытки создать виртуальное окружение:

$ python3 -m venv myvenv2
Error: Command '['/home/sadmin/myvenv2/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

Буду признателен и благодарен за решение проблемы. Если вдруг я где-то заблудился и чего-то не так делаю, прошу строго не судить.
Comment 1 Ivan Zakharyaschev 2016-08-31 18:19:17 MSK
site-packages re-configuration example -- so that new site-packages are seen by the old python3:

http://git.altlinux.org/gears/p/python3.0.git?p=python3.0.git;a=blob;f=python3.spec;h=0df8a1d9dda6e43699ef5dd3881244ea055a8401;hb=3802a4828d5b863cf2ff2d60b5a639e720e705da#l77
Comment 2 Ivan Zakharyaschev 2016-08-31 19:10:24 MSK
Про venv :

при сборке пакета python3 таких лишних неупакованных файлов нет:

warning: Installed (but unpackaged) file(s) found:
    /usr/lib64/libpython3.5m.a

в репозитории пакетов, это содержащих, нет:


[imz@basalt ~]$ fgrep /ensurepip /ALT/Sisyphus/*/base/contents_index 
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__init__.py	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__init__.pyc	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__init__.pyo	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__main__.py	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__main__.pyc	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/__main__.pyo	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/_uninstall.py	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/_uninstall.pyc	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python2.7/ensurepip/_uninstall.pyo	python-modules-ensurepip
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__init__.py	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__main__.py	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__init__.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__init__.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__init__.cpython-35.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__main__.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__main__.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/__main__.cpython-35.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.pyc	python3-base
/ALT/Sisyphus/i586/base/contents_index:/usr/lib/python3.5/ensurepip/_uninstall.py	python3-base
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/doc/python-doc-2.7.12/_sources/library/ensurepip.txt	python-doc
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/doc/python-doc-2.7.12/library/ensurepip.html	python-doc
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/doc/python3-doc-3.5.2/_sources/library/ensurepip.txt	python3-doc
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/doc/python3-doc-3.5.2/library/ensurepip.html	python3-doc
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/__init__$py.class	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/__init__.py	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/__main__$py.class	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/__main__.py	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled/pip-1.6-py2.py3-none-any.whl	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled/setuptools-14.3.2-py2.py3-none-any.whl	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_uninstall$py.class	jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_uninstall.py	jython
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__init__.py	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__init__.pyc	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__init__.pyo	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__main__.py	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__main__.pyc	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/__main__.pyo	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/_uninstall.py	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/_uninstall.pyc	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python2.7/ensurepip/_uninstall.pyo	python-modules-ensurepip
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__init__.py	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__main__.py	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__init__.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__init__.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__init__.cpython-35.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__main__.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__main__.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/__main__.cpython-35.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.opt-1.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.opt-2.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/__pycache__/_uninstall.cpython-35.pyc	python3-base
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/python3.5/ensurepip/_uninstall.py	python3-base
[imz@basalt ~]$ 

Зато это есть у jython.

Откуда это надо брать? Какие идеи? Помощь в правильной упаковке приветствуется.
Comment 3 Ivan Zakharyaschev 2016-08-31 19:14:39 MSK
имею в виду


/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled
   jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled/pip-1.6-py2.py3-none-any.whl
   jython
/ALT/Sisyphus/noarch/base/contents_index:/usr/share/jython/Lib/ensurepip/_bundled/setuptools-14.3.2-py2.py3-none-any.whl
   jython

Терятеся при сборке python3? Или стоит по-другому "настроить" venv при упаковке так, чтобы оно это в другом виде искало?
Comment 4 Dmitry V. Levin 2017-10-28 04:46:14 MSK
Я-то тут причём?
Comment 5 Ivan Zakharyaschev 2018-04-02 17:44:02 MSK
В Debian создают wheels (необходимые для работы venv) при сборке пакетов, по-моему:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703#55

Bug #748301 is the distlib patch to build its wheel.

Bug #748299 is the python-setuptools patch to build its wheel.

и см. также остальные их переделки.
Comment 6 Repository Robot 2019-04-18 18:54:13 MSK
python3-3.7.3-alt1 -> sisyphus:

Tue Apr 02 2019 Grigory Ustinov <grenka@altlinux> 3.7.3-alt1
- Updated to upstream version 3.7.3 (Closes: #36297).
- Added list of architectures which has multilib support in ALT (thx to arei@).
- Added pathfix.py to python3-tools (thx to viy@).
- Bring back venv support (thx to obirvalger@ and imz@) (Closes: #32211).
- Add idle desktop file (Closes: #27542.)