Results 1 to 8 of 8

Thread: Using Virtualenv with Python 3

  1. #1

    Question Using Virtualenv with Python 3

    Hello,

    I just installed openSUSE 12.3 and was trying to setup a Python development environment, so I installed the following packages:
    Code:
    python3, python3-devel, python3-pip
    .

    Then I used pip to install virtualenv:
    Code:
    sudo pip-3.3 install virtualenv
    When I now try to create a virtualenv via
    Code:
    virtualenv-3.3 ~/virtualenvs/venv01
    I get the following error message:

    Code:
    Installing distribute.........................................................................................................................................................................................................................................................................................................................................................................................................done.
    Installing pip....
      Complete output from command /home/name/virtualenvs/venv01/bin/python3 -x /home/name/virtua...v01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz:
      /home/name/virtualenvs/venv01/bin/python3: can't open file '/home/name/virtualenvs/venv01/bin/easy_install': [Errno 2] No such file or directory
    ----------------------------------------
    ...Installing pip...done.
    Traceback (most recent call last):
      File "/usr/local/bin/virtualenv", line 9, in <module>
        load_entry_point('virtualenv==1.9.1', 'console_scripts', 'virtualenv')()
      File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 979, in main
        no_pip=options.no_pip)
      File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1094, in create_environment
        install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
      File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 667, in install_pip
        filter_stdout=_filter_setup)
      File "/usr/local/lib/python3.3/site-packages/virtualenv.py", line 1057, in call_subprocess
        % (cmd_desc, proc.returncode))
    OSError: Command /home/name/virtualenvs/venv01/bin/python3 -x /home/name/virtua...v01/bin/easy_install /usr/local/lib/pytho...ort/pip-1.3.1.tar.gz failed with error code 2
    This seem to a problem due to the fact that openSUSE sets a default distutils prefix (https://en.opensuse.org/openSUSE:Pac...File_locations).

    Due to this prefix distribute is not installed into the directories venv01/lib/python3.3/site-packages and venv01/bin but instead into the directories venv01/local/lib/python3.3/site-packages and venv01/local/bin.

    Is there an easy way to fix this and make virtualenv work in openSUSE?

    This is a really essential tool for my Python development and I would sorely miss it .

    Thanks in advance for any help.

  2. #2

    Default Re: Using Virtualenv with Python 3

    i have the same problem. don't have a solution yet, but thanks for posting - good to know i am not alone!

  3. #3

    Default Re: Using Virtualenv with Python 3


  4. #4

    Default Re: Using Virtualenv with Python 3

    kind-of obvious, but you can work-around this by installing everything yourself (starting with Python 3.3).

    instructions at Andrew Cooke: C[omp]ute

  5. #5

    Default Re: Using Virtualenv with Python 3

    Thanks Andrew, that's probably the easiest solution.

    I attempted messing with local pydistutils.cfg files, but could not really get it working.

    So will simply reinstall my own python according to your instructions.

  6. #6

    Default Re: Using Virtualenv with Python 3

    hello folks, thanks for discovering the problem.

    i pushed a fixed package into devel:languages:python:Factory OBS repository, so as soon as the rebuild finishes you can install python3 from there. (that might be a good idea anyway, if you don't want to wait for official updates)

    alternately, for a workaround on existing installations that doesn't involve rebuilding the whole of python, download this:
    http://users.suse.cz/~jmatejek/fix-virtualenv.patch
    and use it, as root, like this - assuming you are on a 64bit system and that you downloaded the file to your home directory:
    Code:
    # cd /usr/lib64/python
    # patch -p1 < ~/fix-virtualenv.patch

  7. #7

    Default Re: Using Virtualenv with Python 3

    Hi matejcik,

    Awesome that you actually could fix this bug!

    However it seems that the website you hosted the patch on is down.
    Would you care to upload it again? I would really like to take a look where the problem actually came from.

    Thanks again for your awesome work .

    Cheers,

    Gjallar

  8. #8

    Default Re: Using Virtualenv with Python 3

    ah, sorry about that. apparently that URL is internal only.
    this one should work right: http://paste.opensuse.org/view/download/bf0feecd
    (except it apparently doesn't give you the right filename, as it's from a pastebin: http://paste.opensuse.org/bf0feecd
    oh well, i'm sure you can work with that too ;e) )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •