Unable to setup Python-3 virtualenv

I need to set up Python-3 virtualenv on my openSUSE installation, and I am trying to adapt instructions written for Ubuntu. Here is an excerpt from the original instructions:


sudo apt-get install python3 python3-dev
mkdir ~/Dev
cd ~/Dev
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.8.2.tar.gz
tar xvzf virtualenv-1.8.2.tar.gz
mkdir ~/pyenv
python3 ~/Dev/virtualenv-1.8.2.tar.gz/virtualenv.py ~/pyenv/snark -vvv
# more instructions below

I installed python3 with zypper but could not find any equivalent of python3-dev. I proceeded with the instructions anyway. The last step in the above pasted instructions fails to work. Here is the console log.


rahul@acb70333:~/Dev> python3 ~/Dev/virtualenv-1.8.2/virtualenv.py ~/pyenv/snark -vvv 
Creating /home/rahul/pyenv/snark/lib/python3.2
This system uses lib64; symlinking lib64 to lib
Symlinking Python bootstrap modules
  Symlinking /home/rahul/pyenv/snark/lib/python3.2/lib-dynload
  Symlinking /home/rahul/pyenv/snark/lib/python3.2/config-3.2mu
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/os.py
  Ignoring built-in bootstrap module: posix
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/posixpath.py
  Cannot import bootstrap module: nt
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/ntpath.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/genericpath.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/fnmatch.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/locale.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/encodings
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/codecs.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/stat.py
  Cannot import bootstrap module: UserDict
  File /home/rahul/pyenv/snark/lib64/python3.2/lib-dynload/readline.cpython-32mu.so already exists
  Cannot import bootstrap module: copy_reg
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/types.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/re.py
  Cannot import bootstrap module: sre
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/sre_parse.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/sre_constants.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/sre_compile.py
  File /home/rahul/pyenv/snark/lib64/python3.2/lib-dynload/zlib.cpython-32mu.so already exists
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/_abcoll.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/warnings.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/linecache.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/abc.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/io.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/_weakrefset.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/copyreg.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/tempfile.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/random.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/__future__.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/collections.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/keyword.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/tarfile.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/shutil.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/struct.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/copy.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/tokenize.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/token.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/functools.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/heapq.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/bisect.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/weakref.py
  Symlinking /home/rahul/pyenv/snark/lib64/python3.2/reprlib.py
Creating /home/rahul/pyenv/snark/lib/python3.2/site-packages
Writing /home/rahul/pyenv/snark/lib64/python3.2/site.py
Writing /home/rahul/pyenv/snark/lib64/python3.2/orig-prefix.txt
Writing /home/rahul/pyenv/snark/lib64/python3.2/no-global-site-packages.txt
Creating parent directories for /home/rahul/pyenv/snark/include
Symlinking /home/rahul/pyenv/snark/include/python3.2mu
Creating /home/rahul/pyenv/snark/bin
New python executable in /home/rahul/pyenv/snark/bin/python3
Changed mode of /home/rahul/pyenv/snark/bin/python3 to 0o755
Also creating executable in /home/rahul/pyenv/snark/bin/python
Changed mode of /home/rahul/pyenv/snark/bin/python to 0o755
Testing executable with /home/rahul/pyenv/snark/bin/python3 -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))"
Got sys.prefix result: '/home/rahul/pyenv/snark'
Creating /home/rahul/pyenv/snark/lib64/python3.2/distutils
Writing /home/rahul/pyenv/snark/lib64/python3.2/distutils/__init__.py
Writing /home/rahul/pyenv/snark/lib64/python3.2/distutils/distutils.cfg
Using existing distribute egg: /home/rahul/Dev/virtualenv-1.8.2/virtualenv_support/distribute-0.6.28.tar.gz
Installing distribute...
  Running command /home/rahul/pyenv/snark/bin/python3 -c "#!python
\"\"\"Bootstra... main(sys.argv[1:])
" -v --always-copy -U distribute
  Extracting in /tmp/tmp9f9_4y
  Now working in /tmp/tmp9f9_4y/distribute-0.6.28
  Installing Distribute
  creating build
  creating build/src
  creating build/src/docs
  creating build/src/docs/_templates
  creating build/src/docs/_theme
  creating build/src/docs/_theme/nature
  creating build/src/docs/_theme/nature/static
  creating build/src/docs/build
  creating build/src/docs/build/html
  creating build/src/docs/build/html/_sources
  creating build/src/docs/build/html/_static
  creating build/src/setuptools
  creating build/src/setuptools/command
  creating build/src/setuptools/tests
  creating build/src/setuptools/tests/indexes
  creating build/src/setuptools/tests/indexes/test_links_priority
  creating build/src/setuptools/tests/indexes/test_links_priority/simple
  creating build/src/setuptools/tests/indexes/test_links_priority/simple/foobar
  creating build/src/tests
  creating build/src/tests/python3.3_bdist_egg_test
  creating build/src/tests/shlib_test
  copying setuptools/package_index.py -> build/src/setuptools
  copying setuptools/__init__.py -> build/src/setuptools
  copying setuptools/script template.py -> build/src/setuptools
  copying setuptools/script template (dev).py -> build/src/setuptools
  copying setuptools/sandbox.py -> build/src/setuptools
  copying setuptools/dist.py -> build/src/setuptools
  copying setuptools/archive_util.py -> build/src/setuptools
  copying setuptools/depends.py -> build/src/setuptools
  copying setuptools/extension.py -> build/src/setuptools
  copying setuptools/command/easy_install.py -> build/src/setuptools/command
  copying setuptools/command/bdist_wininst.py -> build/src/setuptools/command
  copying setuptools/command/__init__.py -> build/src/setuptools/command
  copying setuptools/command/bdist_egg.py -> build/src/setuptools/command
  copying setuptools/command/sdist.py -> build/src/setuptools/command
  copying setuptools/command/build_py.py -> build/src/setuptools/command
  copying setuptools/command/setopt.py -> build/src/setuptools/command
  copying setuptools/command/register.py -> build/src/setuptools/command
  copying setuptools/command/install_scripts.py -> build/src/setuptools/command
  copying setuptools/command/install.py -> build/src/setuptools/command
  copying setuptools/command/egg_info.py -> build/src/setuptools/command
  copying setuptools/command/bdist_rpm.py -> build/src/setuptools/command
  copying setuptools/command/saveopts.py -> build/src/setuptools/command
  copying setuptools/command/rotate.py -> build/src/setuptools/command
  copying setuptools/command/alias.py -> build/src/setuptools/command
  copying setuptools/command/install_egg_info.py -> build/src/setuptools/command
  copying setuptools/command/upload_docs.py -> build/src/setuptools/command
  copying setuptools/command/develop.py -> build/src/setuptools/command
  copying setuptools/command/test.py -> build/src/setuptools/command
  copying setuptools/command/install_lib.py -> build/src/setuptools/command
  copying setuptools/command/upload.py -> build/src/setuptools/command
  copying setuptools/command/build_ext.py -> build/src/setuptools/command
  copying setuptools/tests/server.py -> build/src/setuptools/tests
  copying setuptools/tests/test_dist_info.py -> build/src/setuptools/tests
  copying setuptools/tests/test_packageindex.py -> build/src/setuptools/tests
  copying setuptools/tests/__init__.py -> build/src/setuptools/tests
  copying setuptools/tests/test_bdist_egg.py -> build/src/setuptools/tests
  copying setuptools/tests/test_build_ext.py -> build/src/setuptools/tests
  copying setuptools/tests/test_sandbox.py -> build/src/setuptools/tests
  copying setuptools/tests/test_resources.py -> build/src/setuptools/tests
  copying setuptools/tests/doctest.py -> build/src/setuptools/tests
  copying setuptools/tests/py26compat.py -> build/src/setuptools/tests
  copying setuptools/tests/test_upload_docs.py -> build/src/setuptools/tests
  copying setuptools/tests/test_easy_install.py -> build/src/setuptools/tests
  copying setuptools/tests/test_develop.py -> build/src/setuptools/tests
  copying setuptools/tests/win_script_wrapper.txt -> build/src/setuptools/tests
  copying setuptools/cli-64.exe -> build/src/setuptools
  copying setuptools/gui-32.exe -> build/src/setuptools
  copying setuptools/gui-64.exe -> build/src/setuptools
  copying setuptools/cli.exe -> build/src/setuptools
  copying setuptools/gui.exe -> build/src/setuptools
  copying setuptools/cli-32.exe -> build/src/setuptools
  copying tests/install_test.py -> build/src/tests
  copying tests/manual_test.py -> build/src/tests
  copying tests/test_python33_bdist_egg.py -> build/src/tests
  copying tests/test_distribute_setup.py -> build/src/tests
  copying tests/python3.3_bdist_egg_test/setup.py -> build/src/tests/python3.3_bdist_egg_test
  copying tests/python3.3_bdist_egg_test/module.py -> build/src/tests/python3.3_bdist_egg_test
  copying tests/shlib_test/setup.py -> build/src/tests/shlib_test
  copying tests/shlib_test/test_hello.py -> build/src/tests/shlib_test
  copying tests/shlib_test/hello.c -> build/src/tests/shlib_test
  copying tests/shlib_test/hellolib.c -> build/src/tests/shlib_test
  copying tests/shlib_test/hello.pyx -> build/src/tests/shlib_test
  copying tests/api_tests.txt -> build/src/tests
  Traceback (most recent call last):
    File "setup.py", line 28, in <module>
      from lib2to3.main import main
  ImportError: No module named lib2to3.main
  Something went wrong during the installation.
  See the error message above.
...Installing distribute...done.
Installing existing pip-1.2.1.tar.gz distribution: /home/rahul/Dev/virtualenv-1.8.2/virtualenv_support/pip-1.2.1.tar.gz
Installing pip...
  Running command /home/rahul/pyenv/snark/bin/python3 -x /home/rahul/pyenv/snark/bin/easy_install /home/rahul/Dev/virt...ort/pip-1.2.1.tar.gz
  /home/rahul/pyenv/snark/bin/python3: can't open file '/home/rahul/pyenv/snark/bin/easy_install': [Errno 2] No such file or directory
  Complete output from command /home/rahul/pyenv/snark/bin/python3 -x /home/rahul/pyenv/snark/bin/easy_install /home/rahul/Dev/virt...ort/pip-1.2.1.tar.gz:
  /home/rahul/pyenv/snark/bin/python3: can't open file '/home/rahul/pyenv/snark/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
  File "/home/rahul/Dev/virtualenv-1.8.2/virtualenv.py", line 2471, in <module>
    main()
  File "/home/rahul/Dev/virtualenv-1.8.2/virtualenv.py", line 942, in main
    never_download=options.never_download)
  File "/home/rahul/Dev/virtualenv-1.8.2/virtualenv.py", line 1054, in create_environment
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
  File "/home/rahul/Dev/virtualenv-1.8.2/virtualenv.py", line 655, in install_pip
    filter_stdout=_filter_setup)
  File "/home/rahul/Dev/virtualenv-1.8.2/virtualenv.py", line 1020, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/rahul/pyenv/snark/bin/python3 -x /home/rahul/pyenv/snark/bin/easy_install /home/rahul/Dev/virt...ort/pip-1.2.1.tar.gz failed with error code 2

Unfortunately I am not adept enough at Linux to be able to debug this. Any help will be greatly appreciated.

Am 06.10.2012 10:26, schrieb missingfaktor:
> I installed python3 with zypper but could not find any equivalent of
> python3-dev.

The equivalent is python3-devel


sudo zypper in python3-devel


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GeForce GT 420
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.2 | HD 3000
eCAFE 800: oS 12.2 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Thank you for your response! I installed python3-devel as suggested, but I still get the same error log on the said command as I pasted in my last post. According to the following part:


Traceback (most recent call last):
    File "setup.py", line 28, in <module>
      from lib2to3.main import main
  ImportError: No module named lib2to3.main
  Something went wrong during the installation.
  See the error message above.

some lib2to3 module seems to be missing. I do not know how to go about installing it. Or I could be wrong about this diagnosis. I am new to Python as well.

Am 06.10.2012 15:36, schrieb missingfaktor:
> some lib2to3 module seems to be missing. I do not know how to go about
> installing it. Or I could be wrong about this diagnosis. I am new to
> Python as well.

Overlooked that in your previous output: Install the package python3-2to3


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GeForce GT 420
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.2 | HD 3000
eCAFE 800: oS 12.2 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Thank you! I was able to move forward in the installation process. :slight_smile:

Now I am stuck at another point.


(snark)rahul@acb70333:~> pip install SQLAlchemy tornado PyHamcrest
Traceback (most recent call last):
  File "/home/rahul/pyenv/snark/bin/pip", line 9, in <module>
    load_entry_point('pip==1.2.1', 'console_scripts', 'pip')()
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 2312, in load_entry_point
    return ep.load()
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 2018, in load
    entry = __import__(self.module_name, globals(),globals(), '__name__'])
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/pip-1.2.1-py3.2.egg/pip/__init__.py", line 9, in <module>
    from pip.basecommand import command_dict, load_command, load_all_commands, command_names
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/pip-1.2.1-py3.2.egg/pip/basecommand.py", line 12, in <module>
    from pip.log import logger
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/pip-1.2.1-py3.2.egg/pip/log.py", line 7, in <module>
    import pip.backwardcompat
  File "/home/rahul/pyenv/snark/lib/python3.2/site-packages/pip-1.2.1-py3.2.egg/pip/backwardcompat.py", line 33, in <module>
    import xmlrpc.client as xmlrpclib
ImportError: No module named xmlrpc.client

Am 06.10.2012 18:36, schrieb missingfaktor:
> ImportError: No module named xmlrpc.client
It is in package python3-xml, install it.


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GeForce GT 420
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.2 | HD 3000
eCAFE 800: oS 12.2 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Installation process completed. Thank you so much! Your help is much appreciated. :slight_smile: