0

I am trying to install and use opencv with Python 3 via Homebrew in macOS Sierra. I followed the steps from this tutorial, but after typing the command pip install virtualenv virtualenvwrapper I get the exception shown below.

When I first tried to install the virtual environment it said it couldn’t find pip. I used sudo easy_install pip and typed again the required command-line.

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'

but after using pip install --user virtualenv virtualenvwrapper it went fine. but after updating the source as given here and source it I get the following -bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory

even after I close the terminal and reopen it in the second line, I see -bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory

please help me :(

Tms91
  • 3,456
  • 6
  • 40
  • 74
hareen tej
  • 89
  • 1
  • 3
  • 9
  • Please copy/paste the error output instead of using an image. – bfontaine Sep 12 '17 at 12:42
  • sorry sir, anyway when i copy and paste the error i cant seperate the lines as in the terminal when i pasted here. you can see the redlines in the image if u dont understand . – hareen tej Sep 12 '17 at 17:49
  • You can use Markdown formatting to nicely separate the lines like in your terminal. [See here](https://stackoverflow.com/editing-help#code) for details on how to create a code block. There are also some shortcuts like pressing Ctrl+K after highlighting your code to automatically indent it so it shows up as a code block. I edited your question to use this feature. – bfontaine Sep 12 '17 at 20:33
  • thank you so much sir for your valuable information on how to seperate the line . and now can you help me on how to install opencv using homebrew? – hareen tej Sep 14 '17 at 06:43

1 Answers1

1

This is a permission issue. As outlined here, you should use the --user option:

pip install --user virtualenv virtualenvwrapper
bfontaine
  • 18,169
  • 13
  • 73
  • 107
  • thanks sir . it worked. but now after updating the path (export PATH=/usr/local/bin:$PATH) in bash profile and verifying the source i get-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory . – hareen tej Sep 14 '17 at 08:28
  • also when i quit the terminal and reopen it i get the following . apper.sh: No such file or directory Ys-MacBook-Air:~ hareentej22$ . so how to get out of the bash . and also i want to completely restart my installation process by completely removing everything that i tried from various blogs like https://alysivji.github.io/setting-up-pyenv-virtualenvwrapper.html . and http://www.pyimagesearch.com/2016/12/05/macos-install-opencv-3-and-python-3-5/ . – hareen tej Sep 14 '17 at 08:31
  • You should search on StackOverflow then ask a new question if you can’t find what you’re looking for because it’s hard to answer you in the comments; I guess you’re loading a non-existing /usr/local/bin/virtualenvwrapper.sh in your bash profile. – bfontaine Sep 14 '17 at 08:53
  • we can communicate through email if u wish to help me . please its so important and hope you can understand – hareen tej Sep 14 '17 at 09:24
  • The problem with email is the next time someone has the same issue they won’t be able to access *your* emails to find the solution. – bfontaine Sep 14 '17 at 09:49
  • i uninstalled homebrew and tried to follow the steps given in [link](http://www.pyimagesearch.com/2016/12/05/macos-install-opencv-3-and-python-3-5/) and pip install --user virtualenv virtualenvwrapper this line worked fine and installed . but when i update the .bash_profile exactly how its said and source it i get the following [-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory] – hareen tej Sep 14 '17 at 10:36