Bug 1386134 - mkvirtualenv does not work with python3-virtualenvwrapper
Summary: mkvirtualenv does not work with python3-virtualenvwrapper
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-virtualenvwrapper
Version: 27
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Lumír Balhar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1402486 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-18 09:12 UTC by Guillaume Bernard
Modified: 2018-03-30 13:13 UTC (History)
6 users (show)

Fixed In Version: python-virtualenvwrapper-4.8.2-4.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-30 13:13:31 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1402486 0 unspecified CLOSED workon completion barfs when only python 3 virtualenvwrapper installed 2021-02-22 00:41:40 UTC

Internal Links: 1402486

Description Guillaume Bernard 2016-10-18 09:12:26 UTC
Description of problem:
When calling `mkvirtualenv` from python3-virtualenvwrapper, the script do not find `virtualenv` in the path.

Version-Release number of selected component (if applicable):
python3-virtualenvwrapper-4.7.1-5.fc25.noarch
python3-virtualenv-15.0.3-1.fc25.noarch

How reproducible:
Always

Steps to Reproduce:
1. Uninstall python2 packages of virtualenvwrapper and virtualenv
# dnf remove python2-virtualenvwrapper.noarch python2-virtualenv.noarch

2. Install python3 package of virtualenvwrapper
# dnf install python3-virtualenvwrapper.noarch

3. Try to create a virtual environment.
$ mkvirtualenv test

Actual results:
$ mkvirtualenv test
which: no virtualenv in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)
ERROR: virtualenvwrapper could not find virtualenv in your path

Expected results:
The virtual environment should be created.

Additional info:
virtualenv is provided py python2-virtualenv. The package python3-virtualenv provides a script named virtualenv-3.5. python3-virtualenv is correctly installed as a dependence of python3-virtualenvwrapper.

Comment 1 Rodolfo Carvalho 2017-01-05 10:38:51 UTC
Run into this today.

A workaround is to add these lines to your .bashrc before sourcing virtualenvwrapper.sh (or virtualenvwrapper_lazy.sh):


# https://bugzilla.redhat.com/show_bug.cgi?id=1402486
# https://bugzilla.redhat.com/show_bug.cgi?id=1386134
VIRTUALENVWRAPPER_PYTHON="$(command which python3)"
VIRTUALENVWRAPPER_VIRTUALENV="py3-virtualenv"
VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone-3"



Note that there is a problem also with VIRTUALENVWRAPPER_VIRTUALENV_CLONE, which is used by the `cpvirtualenv` command.




I think those should be the default fallback values defined in /usr/bin/virtualenvwrapper.sh (provided by python3-virtualenvwrapper):



--- /usr/bin/virtualenvwrapper.sh	2015-08-23 16:50:42.000000000 +0200
+++ /tmp/virtualenvwrapper.sh	2017-01-05 11:28:07.667318278 +0100
@@ -47,19 +47,19 @@
 # Locate the global Python where virtualenvwrapper is installed.
 if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ]
 then
-    VIRTUALENVWRAPPER_PYTHON="$(command \which python)"
+    VIRTUALENVWRAPPER_PYTHON="$(command which python3)"
 fi
 
 # Set the name of the virtualenv app to use.
 if [ "$VIRTUALENVWRAPPER_VIRTUALENV" = "" ]
 then
-    VIRTUALENVWRAPPER_VIRTUALENV="virtualenv"
+    VIRTUALENVWRAPPER_VIRTUALENV="py3-virtualenv"
 fi
 
 # Set the name of the virtualenv-clone app to use.
 if [ "$VIRTUALENVWRAPPER_VIRTUALENV_CLONE" = "" ]
 then
-    VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone"
+    VIRTUALENVWRAPPER_VIRTUALENV_CLONE="virtualenv-clone-3"
 fi
 
 # Define script folder depending on the platorm (Win32/Unix)

Comment 2 Ankur Sinha (FranciscoD) 2017-05-23 15:44:04 UTC
I wonder if it would it make more sense to have two virtualenvwrapper.sh files:

- virtualenvwrapper-3.sh that's set up to use py3 stuff
- virtualenvwrapper-2.sh that's set up to use py2 stuff

The packaging guidelines do mention that something of the sort should be done:

https://fedoraproject.org/wiki/Packaging:Python#Naming

If executables are to be shipped for both python 2 and python 3:

- Both python 2 and python 3 variants must provide symlinks with a '-X' and '-X.Y' suffix (python runtime major version, or python runtime major.minor version), unless upstream already provides appropriately versioned executables without the dash.
- The unversioned executable must be the python2 version.
- For example, the python3 version of "coverage" must ship executables /usr/bin/coverage-3 and /usr/bin/coverage-3.4 (assuming python3 is currently version 3.4), while the python2 version must provide /usr/bin/coverage, /usr/bin/coverage-2 and /usr/bin/coverage-2.7 (assuming python2 version 2.7). 

That would solve these issues?

Comment 3 Rodolfo Carvalho 2017-09-04 12:46:01 UTC
Having different executables would be fine, though, at least at the time of my previous comments, there were also small code changes needed. Haven't checked since then.

Comment 4 Fedora End Of Life 2017-11-16 19:52:56 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2017-12-12 10:54:28 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Mike Goodwin 2018-02-13 03:04:18 UTC
Resurrecting this due to the fact that it is still an issue.

As fedora drags kicking and screaming into being all python3 by default, i think we seriously need to get this fixed. 

Beyond this just not working correctly, it also creates Python2 virtual environments by default! I'll try and evaluate whether or not that warrants another bug.

Also, I think we should continue the discussion about the same defaults above, now that 3.6 recommends using `python -m venv` over all other virutalenv solutions. (What about clone?)

Comment 7 Mike Goodwin 2018-02-13 03:04:49 UTC
*** Bug 1402486 has been marked as a duplicate of this bug. ***

Comment 8 Charalampos Stratakis 2018-03-05 12:01:47 UTC
The project ideally should take advantage of python 3's venv module [0] for the python3 venvs. 

A temporary workaround would be the changes proposed at comment 1 and 2.

[0] https://bitbucket.org/virtualenvwrapper/virtualenvwrapper/issues/309/python-36-depreciation

Comment 9 Lumír Balhar 2018-03-19 13:35:04 UTC
I like the idea mentioned in the first two comments here so I created a new topic in Virtualenvwrapper google groups to discuss it. I am also willing to implement the proposed idea. https://groups.google.com/forum/#!topic/virtualenvwrapper/XTUliDcLnEk

In the meantime, I'll use mentioned patch to change fallback values in shell script provided by python3- subpackage and I'll also address naming rules violations.

Comment 10 Lumír Balhar 2018-03-20 08:36:10 UTC
I've implemented mentioned functionality in a downstream patch. Pull request is here: https://src.fedoraproject.org/rpms/python-virtualenvwrapper/pull-request/1

Feel free to do a review and/or test it.

Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=25832320

Comment 11 Kevin Fenzi 2018-03-21 22:05:49 UTC
Thanks a bunch for that!

Comment 12 Fedora Update System 2018-03-21 22:09:56 UTC
python-virtualenvwrapper-4.8.2-4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-1c442d645a

Comment 13 Fedora Update System 2018-03-22 14:13:39 UTC
python-virtualenvwrapper-4.8.2-4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-1c442d645a

Comment 14 Fedora Update System 2018-03-30 13:13:31 UTC
python-virtualenvwrapper-4.8.2-4.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.