1

I am working on a Ubuntu system which has both Python 2.7 and Python 3.4 installed. I was trying to install the ddt library for creating data driven test cases. However when I try installing using pip:

pip install ddt

I get the following error :

Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files 
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber os.makedirs(destsubdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ddt-1.0.0.dist-info'

Storing debug log for failure in /home/rahul/.pip/pip.log  

The second last line points me in the direction that pip is trying to install ddt for Python 2.7, which I don't want.

How do I install ddt for Python 3.4?

2
  • There will be two versions of pip on your system, one for 2.7 and one for 3.4. It sounds like the 2.7 version is being used, probably through a symlink somewhere on your path. See stackoverflow.com/q/2812520/3376926.
    – tsleyson
    Aug 5, 2015 at 18:46
  • Thank you. I suppose this is what I needed at that time. :) Aug 6, 2015 at 2:28

2 Answers 2

1

The way I corrected this was to manually copy the ddt files from

/usr/local/lib/python2.7/dist-packages

to

/usr/local/lib/python3.4/dist-packages

Copied the following two files :

ddt.py

ddt.pyc

and the directory

ddt-1.0.0.dist-info

If any body could come up with a better solution, then please add your answer. It would be more than welcome :)

1

You should have used the pip3 executable instead:

pip3 install ddt

(might require sudo).

1
  • This one works but at that time I was not aware of pip3. Although your answer works too. Dec 21, 2016 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.