0

It is a tough situation I am dealing with. Here is short version of my problem:

  • I am working on Ubuntu 12.04
  • I would like to install Python 3.5.x with openCV library. I would also like to use pip3 for managing package installation of python.

Here is how the version of my pythons looks like

    $ python --version
      Python 2.7.3
    $ python3 --version
      Python 3.5.2

So far it looks I have achieved my goal.

When I use virtualenv to manage python3 libraries:

   virtualenv -p /usr/bin/python3 py3env
   source py3env/bin/activate

I see the version of my python as follows:

   (py3env)yxxxxa@yxxxxa-Precision-M4800:~$ python3 --version
    Python 3.2.3

I seems there is another version of python in my machine 3.2.3 messing up with the version 3.5.2 that I have installed. This is my first problem.

The second related problem is that I am unable to install pip 3. There is this error I receive due to the same python version conflict:

 $ pip
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor /pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
  warnings.warn(msg)
 Traceback (most recent call last):
   File "/usr/local/bin/pip", line 9, in <module>
 load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
   File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in  load_entry_point
 return get_distribution(dist).load_entry_point(group, name)
   File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
 return ep.load()
    File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
  entry = __import__(self.module_name, globals(),globals(), ['__name__'])
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py", line 16, in <module>
   from pip.vcs import git, mercurial, subversion, bazaar  # noqa
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py", line 9, in <module>
   from pip.download import path_to_url
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py", line 36, in <module>
   from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py", line 15, in <module>
   from pip._vendor.progress.bar import Bar, IncrementalBar
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py", line 48
empty_fill = u'∙'
                  ^
   SyntaxError: invalid syntax
   yasharatena@yasharatena-Precision-M4800:~$ pip3
  /usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
   warnings.warn(msg)
   Traceback (most recent call last):
    File "/usr/local/bin/pip3", line 9, in <module>
   load_entry_point('pip==8.1.2', 'console_scripts', 'pip3')()
    File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
   return get_distribution(dist).load_entry_point(group, name)
    File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in  load_entry_point
   return ep.load()
   File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
   entry = __import__(self.module_name, globals(),globals(), ['__name__'])
   File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py", line 16, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py", line 36, in <module>
    from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py", line 15, in <module>
    from pip._vendor.progress.bar import Bar, IncrementalBar
    File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py", line 48
    empty_fill = u'∙'
                  ^
    SyntaxError: invalid syntax

What are your expert opinions about the stated problem? Any cool idea to handle this? Thanks alot in advance

Berriel
  • 12,659
  • 4
  • 43
  • 67
yas yasi
  • 215
  • 1
  • 6
  • 16

1 Answers1

1

This solved my first problem. Now the second problem aslo remains, how can I install pip3 under python 3.5.2 (preferably using viretualenv) ?

Here is answer:

python3 -m virtualenv py3env

source py3env/bin/activate

Python 3.5 should have pip by default, also after above commands You can use pip:)

For example :

python -m pip install requests

EDIT:

Here You could find very good explainations if You still need install pip after create virtualenv.

Community
  • 1
  • 1
MartinP
  • 527
  • 5
  • 17