Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation Mac osx part1: virtualenv #30

Open
quintendewilde opened this issue Dec 14, 2017 · 20 comments
Open

Installation Mac osx part1: virtualenv #30

quintendewilde opened this issue Dec 14, 2017 · 20 comments

Comments

@quintendewilde
Copy link

I don't think the first part of the installation for mac is working or correct. I followed all the steps and everytime when I mkvirtualenv I get an error command not found. With os python, brew python and on a freshly installed os.

Care to update the installation or be more specific.
Does it need a lign in the bash_profile and such things.

Or is there anybody who can reproduce those steps with a fresh os install (high sierra)?

@alyssaq
Copy link
Owner

alyssaq commented Jan 9, 2018

Hi. Are you using the pip version or cloning from git? Ive just published a new version for macOS High Sierra Python3.6 to PyPI.

@quintendewilde
Copy link
Author

I've tried to install just now on my macbook pro with high sierra.

pip install facemorpher
Requirement already satisfied: facemorpher in /usr/local/lib/python2.7/site-packages
Quintens-MacBook-Pro:face_morpher quintendewilde$ which facemorpher
Quintens-MacBook-Pro:face_morpher quintendewilde$ facemorpher
-bash: facemorpher: command not found

pip3 install facemorpher

Quintens-MacBook-Pro:face_morpher quintendewilde$ sudo pip3 install facemorpher
The directory '/Users/quintendewilde/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/quintendewilde/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: facemorpher in /usr/local/lib/python3.6/site-packages

And via git.

sudo python setup.py install
running install
running build
running build_py
running install_lib
creating /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/cvver.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/aligner.py -> /Library/Python/2.7/site-packages/facemorpher
creating /Library/Python/2.7/site-packages/facemorpher/bin
copying build/lib/facemorpher/bin/stasm_util_osx_cv3 -> /Library/Python/2.7/site-packages/facemorpher/bin
copying build/lib/facemorpher/bin/stasm_util_osx_cv2 -> /Library/Python/2.7/site-packages/facemorpher/bin
copying build/lib/facemorpher/bin/stasm_util_linux_cv3 -> /Library/Python/2.7/site-packages/facemorpher/bin
copying build/lib/facemorpher/bin/stasm_util_linux_cv2 -> /Library/Python/2.7/site-packages/facemorpher/bin
copying build/lib/facemorpher/morpher.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/averager.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/__init__.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/blender.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/locator.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/plotter.py -> /Library/Python/2.7/site-packages/facemorpher
copying build/lib/facemorpher/videoer.py -> /Library/Python/2.7/site-packages/facemorpher
creating /Library/Python/2.7/site-packages/facemorpher/data
copying build/lib/facemorpher/data/haarcascade_mcs_righteye.xml -> /Library/Python/2.7/site-packages/facemorpher/data
copying build/lib/facemorpher/data/haarcascade_frontalface_alt2.xml -> /Library/Python/2.7/site-packages/facemorpher/data
copying build/lib/facemorpher/data/haarcascade_mcs_lefteye.xml -> /Library/Python/2.7/site-packages/facemorpher/data
copying build/lib/facemorpher/warper.py -> /Library/Python/2.7/site-packages/facemorpher
byte-compiling /Library/Python/2.7/site-packages/facemorpher/cvver.py to cvver.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/aligner.py to aligner.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/morpher.py to morpher.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/averager.py to averager.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/__init__.py to __init__.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/blender.py to blender.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/locator.py to locator.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/plotter.py to plotter.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/videoer.py to videoer.pyc
byte-compiling /Library/Python/2.7/site-packages/facemorpher/warper.py to warper.pyc
running install_data
creating /System/Library/Frameworks/Python.framework/Versions/2.7/readme
error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/readme': Operation not permitted

Did you do stuff with your bash profile or else? Otherwise I just don't know why the pip installation doesn't work. Other pip installation do work.

@alyssaq
Copy link
Owner

alyssaq commented Jan 9, 2018

I run all my python3 code in a virtual environment with virtualenvwrapper. Ive also updated the install instructions on the gist for virtualenvwrapper.
Im using opencv3.4. What version are you using? you can check with cv2.__version__
screen shot 2018-01-09 at 8 29 55 pm

@quintendewilde
Copy link
Author

I've enabled it in my bash profile.

And I got in the p3 env.
It shows that i've already installed opencv 3.4 yet when importing it gives me no module?

(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ python
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>> exit()
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ brew install opencv3 --with-python3 
Warning: opencv 3.4.0 is already installed
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ pip install facemorpher
Collecting facemorpher
  Downloading facemorpher-3.1.0.tar.gz (1.5MB)
    100% |████████████████████████████████| 1.5MB 615kB/s 
Building wheels for collected packages: facemorpher
  Running setup.py bdist_wheel for facemorpher ... done
  Stored in directory: /Users/quintendewilde/Library/Caches/pip/wheels/9c/b0/df/c433d7080c818f88cd5ff32ff2b11263972e8da33da0c3fc2b
Successfully built facemorpher
Installing collected packages: facemorpher
Successfully installed facemorpher-3.1.0
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ python3
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>> 

which python gives me

(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ which python
/Users/quintendewilde/.virtualenvs/py3/bin/python

This is everything in my bash profile

#bash_profile
if [ -e /usr/local/bin/virtualenvwrapper.sh ]; then
  source /usr/local/bin/virtualenvwrapper.sh
fi

@alyssaq
Copy link
Owner

alyssaq commented Jan 9, 2018

Did you do the symlink and pythonpath export as in the gist? brew installs opencv but it needs to be available in one your site-packages folder.

@quintendewilde
Copy link
Author

Hi i'm pretty sure I did, but I did it once again. Same for the pythonpath (do I need to change something in that line for my build or can I just copy/paste it?)

(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ brew link python
Warning: Already linked: /usr/local/Cellar/python/2.7.14_2
To relink: brew unlink python && brew link python
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ brew link opencv
Warning: Already linked: /usr/local/Cellar/opencv/3.4.0
To relink: brew unlink opencv && brew link opencv
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ brew unlink opencv && brew link opencv
Unlinking /usr/local/Cellar/opencv/3.4.0... 139 symlinks removed
Linking /usr/local/Cellar/opencv/3.4.0... 139 symlinks created
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ python3
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'

How can I see if its available in my site packages. Thanks for the help so far! :)

@alyssaq
Copy link
Owner

alyssaq commented Jan 9, 2018

You can view a list of the folders where python checks for packages:
$ python -c "import sys; print(sys.path)"
Verify that /usr/local/Cellar/opencv3/3.4.0/lib/python3.6/site-packages is present.

Check whether the cv2 lib is at the site-packages folder:

cd /usr/local/lib/python3.6/site-packages
ls cv*

If you dont see a cv2.*.so, symlink it again
ln -s /usr/local/opt/opencv3/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/lib/python3.6/site-packages/cv2.so

@quintendewilde
Copy link
Author

I get everything I need.

(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ python -c "import sys; print(sys.path)"
['', '/Users/quintendewilde/Documents/face_morpher', '/usr/local/Cellar/opencv3/3.4.0/lib/python3.6/site-packages', '/Users/quintendewilde/.virtualenvs/py3/lib/python36.zip', '/Users/quintendewilde/.virtualenvs/py3/lib/python3.6', '/Users/quintendewilde/.virtualenvs/py3/lib/python3.6/lib-dynload', '/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Users/quintendewilde/.virtualenvs/py3/lib/python3.6/site-packages']
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ cd /usr/local/lib/python3.6/site-packages
(py3) Quintens-MacBook-Pro:site-packages quintendewilde$ ls cv*
cv2.cpython-36m-darwin.so
(py3) Quintens-MacBook-Pro:site-packages quintendewilde$ 

And then I do this?? I think somethings wrong with my links. In the site packages folder I start python => import cv2 = it works and shows me cv2.version when running facemorpher it gives me a whole new error (below in the code). When I go back to the facemorpher folder (cloned from github) I get the module not found error?

(py3) Quintens-MacBook-Pro:site-packages quintendewilde$ python
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.4.0'
>>> import facemorpher
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/facemorpher/__init__.py", line 4, in <module>
    from .morpher import morpher, list_imgpaths
  File "/usr/local/lib/python3.6/site-packages/facemorpher/morpher.py", line 38, in <module>
    from facemorpher import plotter
  File "/usr/local/lib/python3.6/site-packages/facemorpher/plotter.py", line 5, in <module>
    import matplotlib.pyplot as plt
  File "/Users/quintendewilde/.virtualenvs/py3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 116, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/quintendewilde/.virtualenvs/py3/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 60, in pylab_setup
    [backend_name], 0)
  File "/Users/quintendewilde/.virtualenvs/py3/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
    from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
>>> exit()
(py3) Quintens-MacBook-Pro:site-packages quintendewilde$ cd 
(py3) Quintens-MacBook-Pro:~ quintendewilde$ cd Documents
(py3) Quintens-MacBook-Pro:Documents quintendewilde$ ls
Processing			face_morpher
Verticalscreen_faces&text	faker
apps				p5
chrome_agent			vk-bot
(py3) Quintens-MacBook-Pro:Documents quintendewilde$ cd face_morpher
(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ python
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>> 

@alyssaq
Copy link
Owner

alyssaq commented Jan 9, 2018

Ah yeh, Ive run into that matplotlib error in the past. Doing the first answer fixed it: https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python

Can you check in the /usr/local/Cellar:
cd /usr/local/Cellar/opencv/3.4.0/lib/python3.6/site-packages and try importing cv2 there.

@quintendewilde
Copy link
Author

HI! I think I'm getting there.

(py3) Quintens-MacBook-Pro:face_morpher quintendewilde$ cd ~/.matplotlib
(py3) Quintens-MacBook-Pro:.matplotlib quintendewilde$ sudo nano ~/.matplotlib/matplotlibrc
Password:
(py3) Quintens-MacBook-Pro:.matplotlib quintendewilde$ cd /usr/local/lib/python3.6/site-packages
(py3) Quintens-MacBook-Pro:site-packages quintendewilde$ python
Python 3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import facemorpher
>>> facemorpher.morpher
<function morpher at 0x10e386ae8>

So my guess is that it works in the site-packages folder and now I need to make it work in the facemorpher folder.

If I check /usr/local/lib: I get a bunch of files.
And for the last line I'm not sure how to import cv2 in there? Do I cd in to that folder and then try to import cv2 (which I did and that worked) or do I need to copy folders from /usr/local/lib: ? Bit lost at that one. :)

Quintens-MacBook-Pro:~ quintendewilde$ cd /usr/local/lib
Quintens-MacBook-Pro:lib quintendewilde$ ls
BugpointPasses.dylib			libclangRewriteFrontend.a
LLVMHello.dylib				libclangSema.a
LLVMPolly.so				libclangSerialization.a
clang					libclangStaticAnalyzerCheckers.a
cmake					libclangStaticAnalyzerCore.a
dtrace					libclangStaticAnalyzerFrontend.a
libHalf.12.dylib			libclangTidy.a
libHalf.a				libclangTidyAndroidModule.a
libHalf.dylib				libclangTidyBoostModule.a
libIex-2_2.12.dylib			libclangTidyBugproneModule.a
libIex.a				libclangTidyCERTModule.a
libIex.dylib				libclangTidyCppCoreGuidelinesModule.a
libIexMath-2_2.12.dylib			libclangTidyGoogleModule.a
libIexMath.a				libclangTidyHICPPModule.a
libIexMath.dylib			libclangTidyLLVMModule.a
libIlmImf-2_2.22.dylib			libclangTidyMPIModule.a
libIlmImf.a				libclangTidyMiscModule.a
libIlmImf.dylib				libclangTidyModernizeModule.a
libIlmImfUtil-2_2.22.dylib		libclangTidyPerformanceModule.a
libIlmImfUtil.a				libclangTidyPlugin.a
libIlmImfUtil.dylib			libclangTidyReadabilityModule.a
libIlmThread-2_2.12.dylib		libclangTidyUtils.a
libIlmThread.a				libclangTooling.a
libIlmThread.dylib			libclangToolingCore.a
libImath-2_2.12.dylib			libclangToolingRefactor.a
libImath.a				libfindAllSymbols.a
libImath.dylib				libgdbm.4.dylib
libLLVM.dylib				libgdbm.5.dylib
libLLVMAArch64AsmParser.a		libgdbm.a
libLLVMAArch64AsmPrinter.a		libgdbm.dylib
libLLVMAArch64CodeGen.a			libgomp.dylib
libLLVMAArch64Desc.a			libiomp5.dylib
libLLVMAArch64Disassembler.a		libjpeg.9.dylib
libLLVMAArch64Info.a			libjpeg.a
libLLVMAArch64Utils.a			libjpeg.dylib
libLLVMAMDGPUAsmParser.a		liblldCOFF.a
libLLVMAMDGPUAsmPrinter.a		liblldConfig.a
libLLVMAMDGPUCodeGen.a			liblldCore.a
libLLVMAMDGPUDesc.a			liblldDriver.a
libLLVMAMDGPUDisassembler.a		liblldELF.a
libLLVMAMDGPUInfo.a			liblldMachO.a
libLLVMAMDGPUUtils.a			liblldReaderWriter.a
libLLVMARMAsmParser.a			liblldYAML.a
libLLVMARMAsmPrinter.a			liblzma.5.dylib
libLLVMARMCodeGen.a			liblzma.a
libLLVMARMDesc.a			liblzma.dylib
libLLVMARMDisassembler.a		libmp3lame.0.dylib
libLLVMARMInfo.a			libmp3lame.a
libLLVMAnalysis.a			libmp3lame.dylib
libLLVMAsmParser.a			libomp.dylib
libLLVMAsmPrinter.a			libopencv_aruco.3.4.0.dylib
libLLVMBPFAsmPrinter.a			libopencv_aruco.3.4.dylib
libLLVMBPFCodeGen.a			libopencv_aruco.dylib
libLLVMBPFDesc.a			libopencv_bgsegm.3.4.0.dylib
libLLVMBPFDisassembler.a		libopencv_bgsegm.3.4.dylib
libLLVMBPFInfo.a			libopencv_bgsegm.dylib
libLLVMBinaryFormat.a			libopencv_bioinspired.3.4.0.dylib
libLLVMBitReader.a			libopencv_bioinspired.3.4.dylib
libLLVMBitWriter.a			libopencv_bioinspired.dylib
libLLVMCodeGen.a			libopencv_calib3d.3.4.0.dylib
libLLVMCore.a				libopencv_calib3d.3.4.dylib
libLLVMCoroutines.a			libopencv_calib3d.dylib
libLLVMCoverage.a			libopencv_ccalib.3.4.0.dylib
libLLVMDebugInfoCodeView.a		libopencv_ccalib.3.4.dylib
libLLVMDebugInfoDWARF.a			libopencv_ccalib.dylib
libLLVMDebugInfoMSF.a			libopencv_core.3.4.0.dylib
libLLVMDebugInfoPDB.a			libopencv_core.3.4.dylib
libLLVMDemangle.a			libopencv_core.dylib
libLLVMDlltoolDriver.a			libopencv_datasets.3.4.0.dylib
libLLVMExecutionEngine.a		libopencv_datasets.3.4.dylib
libLLVMGlobalISel.a			libopencv_datasets.dylib
libLLVMHexagonAsmParser.a		libopencv_dnn.3.4.0.dylib
libLLVMHexagonCodeGen.a			libopencv_dnn.3.4.dylib
libLLVMHexagonDesc.a			libopencv_dnn.dylib
libLLVMHexagonDisassembler.a		libopencv_dpm.3.4.0.dylib
libLLVMHexagonInfo.a			libopencv_dpm.3.4.dylib
libLLVMIRReader.a			libopencv_dpm.dylib
libLLVMInstCombine.a			libopencv_face.3.4.0.dylib
libLLVMInstrumentation.a		libopencv_face.3.4.dylib
libLLVMInterpreter.a			libopencv_face.dylib
libLLVMLTO.a				libopencv_features2d.3.4.0.dylib
libLLVMLanaiAsmParser.a			libopencv_features2d.3.4.dylib
libLLVMLanaiAsmPrinter.a		libopencv_features2d.dylib
libLLVMLanaiCodeGen.a			libopencv_flann.3.4.0.dylib
libLLVMLanaiDesc.a			libopencv_flann.3.4.dylib
libLLVMLanaiDisassembler.a		libopencv_flann.dylib
libLLVMLanaiInfo.a			libopencv_fuzzy.3.4.0.dylib
libLLVMLibDriver.a			libopencv_fuzzy.3.4.dylib
libLLVMLineEditor.a			libopencv_fuzzy.dylib
libLLVMLinker.a				libopencv_highgui.3.4.0.dylib
libLLVMMC.a				libopencv_highgui.3.4.dylib
libLLVMMCDisassembler.a			libopencv_highgui.dylib
libLLVMMCJIT.a				libopencv_img_hash.3.4.0.dylib
libLLVMMCParser.a			libopencv_img_hash.3.4.dylib
libLLVMMIRParser.a			libopencv_img_hash.dylib
libLLVMMSP430AsmPrinter.a		libopencv_imgcodecs.3.4.0.dylib
libLLVMMSP430CodeGen.a			libopencv_imgcodecs.3.4.dylib
libLLVMMSP430Desc.a			libopencv_imgcodecs.dylib
libLLVMMSP430Info.a			libopencv_imgproc.3.4.0.dylib
libLLVMMipsAsmParser.a			libopencv_imgproc.3.4.dylib
libLLVMMipsAsmPrinter.a			libopencv_imgproc.dylib
libLLVMMipsCodeGen.a			libopencv_line_descriptor.3.4.0.dylib
libLLVMMipsDesc.a			libopencv_line_descriptor.3.4.dylib
libLLVMMipsDisassembler.a		libopencv_line_descriptor.dylib
libLLVMMipsInfo.a			libopencv_ml.3.4.0.dylib
libLLVMNVPTXAsmPrinter.a		libopencv_ml.3.4.dylib
libLLVMNVPTXCodeGen.a			libopencv_ml.dylib
libLLVMNVPTXDesc.a			libopencv_objdetect.3.4.0.dylib
libLLVMNVPTXInfo.a			libopencv_objdetect.3.4.dylib
libLLVMObjCARCOpts.a			libopencv_objdetect.dylib
libLLVMObject.a				libopencv_optflow.3.4.0.dylib
libLLVMObjectYAML.a			libopencv_optflow.3.4.dylib
libLLVMOption.a				libopencv_optflow.dylib
libLLVMOrcJIT.a				libopencv_phase_unwrapping.3.4.0.dylib
libLLVMPasses.a				libopencv_phase_unwrapping.3.4.dylib
libLLVMPowerPCAsmParser.a		libopencv_phase_unwrapping.dylib
libLLVMPowerPCAsmPrinter.a		libopencv_photo.3.4.0.dylib
libLLVMPowerPCCodeGen.a			libopencv_photo.3.4.dylib
libLLVMPowerPCDesc.a			libopencv_photo.dylib
libLLVMPowerPCDisassembler.a		libopencv_plot.3.4.0.dylib
libLLVMPowerPCInfo.a			libopencv_plot.3.4.dylib
libLLVMProfileData.a			libopencv_plot.dylib
libLLVMRuntimeDyld.a			libopencv_reg.3.4.0.dylib
libLLVMScalarOpts.a			libopencv_reg.3.4.dylib
libLLVMSelectionDAG.a			libopencv_reg.dylib
libLLVMSparcAsmParser.a			libopencv_rgbd.3.4.0.dylib
libLLVMSparcAsmPrinter.a		libopencv_rgbd.3.4.dylib
libLLVMSparcCodeGen.a			libopencv_rgbd.dylib
libLLVMSparcDesc.a			libopencv_saliency.3.4.0.dylib
libLLVMSparcDisassembler.a		libopencv_saliency.3.4.dylib
libLLVMSparcInfo.a			libopencv_saliency.dylib
libLLVMSupport.a			libopencv_shape.3.4.0.dylib
libLLVMSymbolize.a			libopencv_shape.3.4.dylib
libLLVMSystemZAsmParser.a		libopencv_shape.dylib
libLLVMSystemZAsmPrinter.a		libopencv_stereo.3.4.0.dylib
libLLVMSystemZCodeGen.a			libopencv_stereo.3.4.dylib
libLLVMSystemZDesc.a			libopencv_stereo.dylib
libLLVMSystemZDisassembler.a		libopencv_stitching.3.4.0.dylib
libLLVMSystemZInfo.a			libopencv_stitching.3.4.dylib
libLLVMTableGen.a			libopencv_stitching.dylib
libLLVMTarget.a				libopencv_structured_light.3.4.0.dylib
libLLVMTransformUtils.a			libopencv_structured_light.3.4.dylib
libLLVMVectorize.a			libopencv_structured_light.dylib
libLLVMX86AsmParser.a			libopencv_superres.3.4.0.dylib
libLLVMX86AsmPrinter.a			libopencv_superres.3.4.dylib
libLLVMX86CodeGen.a			libopencv_superres.dylib
libLLVMX86Desc.a			libopencv_surface_matching.3.4.0.dylib
libLLVMX86Disassembler.a		libopencv_surface_matching.3.4.dylib
libLLVMX86Info.a			libopencv_surface_matching.dylib
libLLVMX86Utils.a			libopencv_text.3.4.0.dylib
libLLVMXCoreAsmPrinter.a		libopencv_text.3.4.dylib
libLLVMXCoreCodeGen.a			libopencv_text.dylib
libLLVMXCoreDesc.a			libopencv_tracking.3.4.0.dylib
libLLVMXCoreDisassembler.a		libopencv_tracking.3.4.dylib
libLLVMXCoreInfo.a			libopencv_tracking.dylib
libLLVMXRay.a				libopencv_video.3.4.0.dylib
libLLVMipo.a				libopencv_video.3.4.dylib
libLTO.dylib				libopencv_video.dylib
libPolly.a				libopencv_videoio.3.4.0.dylib
libPollyISL.a				libopencv_videoio.3.4.dylib
libPollyPPCG.a				libopencv_videoio.dylib
libavcodec.57.107.100.dylib		libopencv_videostab.3.4.0.dylib
libavcodec.57.dylib			libopencv_videostab.3.4.dylib
libavcodec.a				libopencv_videostab.dylib
libavcodec.dylib			libopencv_xfeatures2d.3.4.0.dylib
libavdevice.57.10.100.dylib		libopencv_xfeatures2d.3.4.dylib
libavdevice.57.dylib			libopencv_xfeatures2d.dylib
libavdevice.a				libopencv_ximgproc.3.4.0.dylib
libavdevice.dylib			libopencv_ximgproc.3.4.dylib
libavfilter.6.107.100.dylib		libopencv_ximgproc.dylib
libavfilter.6.dylib			libopencv_xobjdetect.3.4.0.dylib
libavfilter.a				libopencv_xobjdetect.3.4.dylib
libavfilter.dylib			libopencv_xobjdetect.dylib
libavformat.57.83.100.dylib		libopencv_xphoto.3.4.0.dylib
libavformat.57.dylib			libopencv_xphoto.3.4.dylib
libavformat.a				libopencv_xphoto.dylib
libavformat.dylib			libpng.a
libavresample.3.7.0.dylib		libpng.dylib
libavresample.3.dylib			libpng16.16.dylib
libavresample.a				libpng16.a
libavresample.dylib			libpng16.dylib
libavutil.55.78.100.dylib		libpostproc.54.7.100.dylib
libavutil.55.dylib			libpostproc.54.dylib
libavutil.a				libpostproc.a
libavutil.dylib				libpostproc.dylib
libc++.1.0.dylib			libswresample.2.9.100.dylib
libc++.1.dylib				libswresample.2.dylib
libc++.a				libswresample.a
libc++.dylib				libswresample.dylib
libc++experimental.a			libswscale.4.8.100.dylib
libclang.dylib				libswscale.4.dylib
libclangARCMigrate.a			libswscale.a
libclangAST.a				libswscale.dylib
libclangASTMatchers.a			libtbb.dylib
libclangAnalysis.a			libtbbmalloc.dylib
libclangApplyReplacements.a		libtbbmalloc_proxy.dylib
libclangBasic.a				libtiff.5.dylib
libclangChangeNamespace.a		libtiff.a
libclangCodeGen.a			libtiff.dylib
libclangDaemon.a			libtiffxx.5.dylib
libclangDriver.a			libtiffxx.a
libclangDynamicASTMatchers.a		libtiffxx.dylib
libclangEdit.a				libunwind.1.0.dylib
libclangFormat.a			libunwind.1.dylib
libclangFrontend.a			libunwind.a
libclangFrontendTool.a			libunwind.dylib
libclangIncludeFixer.a			libx264.148.dylib
libclangIncludeFixerPlugin.a		libx264.a
libclangIndex.a				libx264.dylib
libclangLex.a				libxvidcore.4.dylib
libclangMove.a				libxvidcore.a
libclangParse.a				node_modules
libclangQuery.a				pkgconfig
libclangReorderFields.a			python2.7
libclangRewrite.a			python3.6

@alyssaq
Copy link
Owner

alyssaq commented Jan 10, 2018

So is the current issue that you cant import cv2 from a non site-packages folder?
Are you able to run the examples? You dont need to be in the face_morpher folder since you've already pip installed: https://github.com/alyssaq/face_morpher#examples

@quintendewilde
Copy link
Author

Alright I added the path in my bash_profile.
And installed pip3 install docopt sh. I got this from a stack overflow page.

And the weird part is it works in my normal environment and not in the P3 .env I created..
Following is when I try to test it with two lo res images I get this error.

Quintens-MBP:face_morpher quintendewilde$ python facemorpher/morpher.py --src=01.jpg --dest=02.jpg 
dyld: Library not loaded: /usr/local/opt/opencv3/lib/libopencv_stitching.3.2.dylib
  Referenced from: /usr/local/lib/python3.6/site-packages/facemorpher/bin/stasm_util_osx_cv3
  Reason: image not found
Traceback (most recent call last):
  File "facemorpher/morpher.py", line 148, in <module>
    main()
  File "facemorpher/morpher.py", line 145, in main
    args['--alpha'], args['--plot'])
  File "facemorpher/morpher.py", line 130, in morpher
    src_img, src_points = next(images_points_gen)
  File "facemorpher/morpher.py", line 66, in load_valid_image_points
    img, points = load_image_points(path, size)
  File "facemorpher/morpher.py", line 56, in load_image_points
    points = locator.face_points(path)
  File "/usr/local/lib/python3.6/site-packages/facemorpher/locator.py", line 56, in face_points
    s = subprocess.check_output(command, universal_newlines=True)
  File "/Users/quintendewilde/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/Users/quintendewilde/anaconda3/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/local/lib/python3.6/site-packages/facemorpher/bin/stasm_util_osx_cv3', '-f', '/usr/local/lib/python3.6/site-packages/facemorpher/data', '01.jpg']' died with <Signals.SIGABRT: 6>.

I tried global paths as well no succes. Could it be that the image quality is to low?

@alyssaq
Copy link
Owner

alyssaq commented Jan 10, 2018

I published a fix for that yesterday. Could you uninstall and reinstall facemorpher via pip? Or git pull the changes.

@quintendewilde
Copy link
Author

I think there is something wrong with the brew installation for opencv3.

When I go out my environment I can import cv2 when I go in my env : module not found?

when I list brew list opencv

brew list opencv3
/usr/local/Cellar/opencv/3.4.0/bin/opencv_annotation
/usr/local/Cellar/opencv/3.4.0/bin/opencv_createsamples
/usr/local/Cellar/opencv/3.4.0/bin/opencv_interactive-calibration
/usr/local/Cellar/opencv/3.4.0/bin/opencv_traincascade
/usr/local/Cellar/opencv/3.4.0/bin/opencv_version
/usr/local/Cellar/opencv/3.4.0/bin/opencv_visualisation
/usr/local/Cellar/opencv/3.4.0/bin/opencv_waldboost_detector
/usr/local/Cellar/opencv/3.4.0/include/opencv/ (11 files)
/usr/local/Cellar/opencv/3.4.0/include/opencv2/ (352 files)
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_aruco.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_bgsegm.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_bioinspired.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_calib3d.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_ccalib.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_core.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_datasets.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_dnn.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_dpm.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_face.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_features2d.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_flann.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_fuzzy.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_highgui.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_img_hash.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_imgcodecs.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_imgproc.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_line_descriptor.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_ml.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_objdetect.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_optflow.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_phase_unwrapping.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_photo.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_plot.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_reg.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_rgbd.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_saliency.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_shape.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_stereo.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_stitching.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_structured_light.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_superres.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_surface_matching.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_text.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_tracking.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_video.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_videoio.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_videostab.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_xfeatures2d.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_ximgproc.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_xobjdetect.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/libopencv_xphoto.3.4.0.dylib
/usr/local/Cellar/opencv/3.4.0/lib/pkgconfig/opencv.pc
/usr/local/Cellar/opencv/3.4.0/lib/python2.7/site-packages/cv2.so
/usr/local/Cellar/opencv/3.4.0/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
/usr/local/Cellar/opencv/3.4.0/lib/ (84 other files)
/usr/local/Cellar/opencv/3.4.0/share/OpenCV/ (28 files)

My installation from the virtualenv on:

Quintens-MacBook-Pro:~ quintendewilde$ sudo -H pip3 install virtualenv
Password:
Requirement already satisfied: virtualenv in /usr/local/lib/python3.6/site-packages
Quintens-MacBook-Pro:~ quintendewilde$ sudo -H pip3 install virtualenvwrapper --ignore-installed six
Collecting virtualenvwrapper
  Using cached virtualenvwrapper-4.8.2-py2.py3-none-any.whl
Collecting six
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting stevedore (from virtualenvwrapper)
  Using cached stevedore-1.28.0-py2.py3-none-any.whl
Collecting virtualenv-clone (from virtualenvwrapper)
Collecting virtualenv (from virtualenvwrapper)
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Collecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)
  Using cached pbr-3.1.1-py2.py3-none-any.whl
Installing collected packages: six, pbr, stevedore, virtualenv-clone, virtualenv, virtualenvwrapper
Successfully installed pbr-3.1.1 six-1.11.0 stevedore-1.28.0 virtualenv-15.1.0 virtualenv-clone-0.2.6 virtualenvwrapper-4.8.2

My bash_profile :

# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

if [ -e /usr/local/bin/virtualenvwrapper.sh ]; then
  source /usr/local/bin/virtualenvwrapper.sh
fi

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    source $(brew --prefix)/etc/bash_completion
fi

And again a virtualenv error.


Quintens-MacBook-Pro:~ quintendewilde$ mkvirtualenv --python=`which python3.6` py3
Running virtualenv with interpreter /usr/local/bin/python3.6
Using base prefix '/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/quintendewilde/.virtualenvs/py3/bin/python3.6
Not overwriting existing python script /Users/quintendewilde/.virtualenvs/py3/bin/python (you must use /Users/quintendewilde/.virtualenvs/py3/bin/python3.6)
Installing setuptools, pip, wheel...done.
/usr/bin/python: No module named virtualenvwrapper

So sorry to bother you so much with this, but it seems to be haunting me the virtaul env ^^

@alyssaq
Copy link
Owner

alyssaq commented Jan 10, 2018

Taken from the docs (edited the last line):

$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv --python=`which python3.6` py3

The docs are pretty useful and I recommend reading it to learn the commands:
http://virtualenvwrapper.readthedocs.io/en/latest/

@quintendewilde
Copy link
Author

Hi, yeah I did not read the docs that intensively.
But I'd managed to do all of these things before, still from the moment I install opencv with brew I doesn't get recognized in my virtual environment. I just find it so hard to believe that with the same OS and following the instruction step by step that it doesn't work for me? I've managed to install complexer ML based projects.

So I'm giving up on this, will look/learn more on these things and maybe try it on some later moment. Anyways THANKS so much for all the help and for the wonderful project!!

@alyssaq
Copy link
Owner

alyssaq commented Jan 10, 2018

No problems. You dont need to use virtualenv or virtualenvwrapper. These are additional tools to help create isolated environments with different python dependencies that can be useful when you're developing or testing different python apps.

@quintendewilde
Copy link
Author

Hey! Hehe couldn't help it to stay of it..
But I got it installed! Follow this blog and your installation added the matplotlib error and it's installed! Both opencv & facemorpher (pip and python)! :)

But... I get this.

quintendewilde$ facemorpher --src=Users/quintendewilde/Documents/face_morpher/facemorpher/images/0.png --dest=/Users/quintendewilde/Documents/face_morpher/facemorpher/images/1.png 
--src=Users/quintendewilde/Documents/face_morpher/facemorpher/images/0.png or --dest=/Users/quintendewilde/Documents/face_morpher/facemorpher/images/1.png are not valid images

Should I make a new issue for this?

@alyssaq
Copy link
Owner

alyssaq commented Jan 11, 2018

That error shows up when a file doesnt exist. Double check your file path and that 0.png and 1.png are present.

@alyssaq
Copy link
Owner

alyssaq commented Jan 21, 2018

Made a fix for --out_video. Should work on osx with facemorper-3.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants