mabl / PyPylon

An experimental python wrapper around the Basler Pylon 5 library
BSD 3-Clause "New" or "Revised" License
53 stars 34 forks source link

how to install #43

Open istvanUniv opened 6 years ago

istvanUniv commented 6 years ago

Hello,

I very new to Python - sorry if it's a silly question. But, how do you install this package?

Using: Ubuntu 14.04 + Python 3.6.5

Trying to run from a terminal under PyPylon-master/examples$ python3.6 list_cameras.py returns an error: No module named 'pypylon'

I guess I need to integrate this package into Python. But I do not know how.

Thank you for any suggestion!

istvanUniv commented 6 years ago

Update: trying: /PyPylon-master/PyPylon$ sudo python3.6 setup.py also gives an error: No module named 'setuptools'

vascotenner commented 6 years ago

I recommend to install this software via pip: /PyPylon-master/PyPylon$ sudo pip install .

How did you install python on your system? For development purposes, I recommend to install the anaconda distribution in user space.

Else see: https://stackoverflow.com/questions/22531360/no-module-named-setuptools

istvanUniv commented 6 years ago

Thank you for the reply.

I installed python 3.6 by sudo apt-get install python3.6 and then changed the python to python3 (alias python=python3). This is the version I must use (needed by the project). Is the package not compatible?

I also installed pip.

So now: python -V is Python 3.6.5 pip -V is pip 10.0.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

But if I try sudo pip install .
I get the error: No module named 'Cython' (details below)

Any ideas?

------ details on error ------------

Trying robo1@robo1-VIG800S:~/SOFTWARE/PyPylon$ sudo pip install . The directory '/home/robo1/.cache/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 '/home/robo1/.cache/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. Processing /home/robo1/SOFTWARE/PyPylon Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-req-build-qhjyp448/setup.py", line 2, in from Cython.Distutils import build_ext, Extension ModuleNotFoundError: No module named 'Cython' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/init.py", line 5, in from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in import apt File "/usr/lib/python3/dist-packages/apt/init.py", line 23, in import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-qhjyp448/setup.py", line 2, in <module>
    from Cython.Distutils import build_ext, Extension
ModuleNotFoundError: No module named 'Cython'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-qhjyp448/


Thank you!

istvanUniv commented 6 years ago

UPDATE:

Ok, I think it installed. The solution was installing cython and numpy separately, by:

$ sudo pip install --upgrade cython $ sudo pip install numpy

Then install pypylon by entering its folder and calling: $ sudo pip install .

istvanUniv commented 6 years ago

another way it to make sure you have python3, pip3 installed and run $ python3 -m pip install -e .

istvanUniv commented 6 years ago

you also need matplotlib: $ python3 -mpip install -U matplotlib

istvanUniv commented 6 years ago

you also need tqdm: $ pip3 install tqdm

...now you can run the example file: $ python3 list_cameras.py

vascotenner commented 6 years ago

@istvanUniv Thank you for sharing these dependecies/installation instructions.

yasminab commented 6 years ago

Hey guys, I am trying to install it for 2 days now and in the process I deleted everything and reinstalled all. means python pylon and all of the packages and compiler for python 2.7 and so. still it fails and I don't understand why... can somone help?

(yasmin) C:\Users\amoutenet\Desktop\PyPylon-master>pip install . Processing c:\users\amoutenet\desktop\pypylon-master Building wheels for collected packages: pypylon Running setup.py bdist_wheel for pypylon ... error Complete output from command c:\users\amoutenet\appdata\local\continuum\minico nda2\envs\yasmin\python.exe -u -c "import setuptools, tokenize;file='c:\use rs\amoute~1\appdata\local\temp\pip-req-build-nyy4tt\setup.py';f=getattr(to kenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();ex ec(compile(code, file, 'exec'))" bdist_wheel -d c:\users\amoute~1\appdata\lo cal\temp\pip-wheel-pf1dhr --python-tag cp27: running bdist_wheel running build running build_py creating build creating build\lib.win32-2.7 creating build\lib.win32-2.7\pypylon copying pypylon__init.py -> build\lib.win32-2.7\pypylon creating build\lib.win32-2.7\pypylon\cython copying pypylon\cython\init__.py -> build\lib.win32-2.7\pypylon\cython running build_ext cythoning cython/version.pyx to cython\version.cpp building 'pypylon.cython.version' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\cython C:\Users\amoutenet\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG "-IC:\Program Files\Ba sler\pylon 5\Development\include" -Ic:\users\amoutenet\appdata\local\continuum\m iniconda2\envs\yasmin\lib\site-packages\numpy\core\include -Ic:\users\amoutenet\ appdata\local\continuum\miniconda2\envs\yasmin\include -Ic:\users\amoutenet\appd ata\local\continuum\miniconda2\envs\yasmin\PC /Tpcython\version.cpp /Fobuild\tem p.win32-2.7\Release\cython\version.obj version.cpp C:\Users\amoutenet\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth on\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:\Program Files\B asler\pylon 5\Runtime\Win32" "/LIBPATH:C:\Program Files\Basler\pylon 5\Developme nt\lib\Win32" /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda2\env s\yasmin\libs /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda2\env s\yasmin\PCbuild /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda2\ envs\yasmin\PC\VS9.0 GCBase_MD_VC120_v3_0_Basler_pylon_v5_0.lib GenApi_MDVC120 v3_0_Basler_pylon_v5_0.lib PylonBase_MD_VC120_v5_0.lib PylonC_MD_BCC55.lib Pylon C_MD_VC120.lib PylonGUI_MD_VC120_v5_0.lib PylonUtility_MD_VC120_v5_0.lib /EXPORT :initversion build\temp.win32-2.7\Release\cython\version.obj /OUT:build\lib.win3 2-2.7\pypylon\cython\version.pyd /IMPLIB:build\temp.win32-2.7\Release\cython\ver sion.lib /MANIFESTFILE:build\temp.win32-2.7\Release\cython\version.pyd.manifest C:\Program Files\Basler\pylon 5\Development\lib\Win32\PylonC_MD_BCC55.lib : fa tal error LNK1136: invalid or corrupt file error: command 'C:\Users\amoutenet\AppData\Local\Programs\Common\Micros oft\Visual C++ for Python\9.0\VC\Bin\link.exe' failed with exit status 1136


Failed building wheel for pypylon Running setup.py clean for pypylon Failed to build pypylon Installing collected packages: pypylon Running setup.py install for pypylon ... error Complete output from command c:\users\amoutenet\appdata\local\continuum\mini conda2\envs\yasmin\python.exe -u -c "import setuptools, tokenize;file='c:\u sers\amoute~1\appdata\local\temp\pip-req-build-nyy4tt\setup.py';f=getattr( tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close(); exec(compile(code, file, 'exec'))" install --record c:\users\amoute~1\appdat a\local\temp\pip-record-oyeuv9\install-record.txt --single-version-externally-ma naged --compile: running install running build running build_py creating build creating build\lib.win32-2.7 creating build\lib.win32-2.7\pypylon copying pypylon__init.py -> build\lib.win32-2.7\pypylon creating build\lib.win32-2.7\pypylon\cython copying pypylon\cython\init__.py -> build\lib.win32-2.7\pypylon\cython running build_ext skipping 'cython\version.cpp' Cython extension (up-to-date) building 'pypylon.cython.version' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\cython C:\Users\amoutenet\AppData\Local\Programs\Common\Microsoft\Visual C++ for Py thon\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG "-IC:\Program Files\ Basler\pylon 5\Development\include" -Ic:\users\amoutenet\appdata\local\continuum \miniconda2\envs\yasmin\lib\site-packages\numpy\core\include -Ic:\users\amoutene t\appdata\local\continuum\miniconda2\envs\yasmin\include -Ic:\users\amoutenet\ap pdata\local\continuum\miniconda2\envs\yasmin\PC /Tpcython\version.cpp /Fobuild\t emp.win32-2.7\Release\cython\version.obj version.cpp C:\Users\amoutenet\AppData\Local\Programs\Common\Microsoft\Visual C++ for Py thon\9.0\VC\Bin\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:\Program Files \Basler\pylon 5\Runtime\Win32" "/LIBPATH:C:\Program Files\Basler\pylon 5\Develop ment\lib\Win32" /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda2\e nvs\yasmin\libs /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda2\e nvs\yasmin\PCbuild /LIBPATH:c:\users\amoutenet\appdata\local\continuum\miniconda 2\envs\yasmin\PC\VS9.0 GCBase_MD_VC120_v3_0_Basler_pylon_v5_0.lib GenApi_MD_VC12 0_v3_0_Basler_pylon_v5_0.lib PylonBase_MD_VC120_v5_0.lib PylonC_MD_BCC55.lib Pyl onC_MD_VC120.lib PylonGUI_MD_VC120_v5_0.lib PylonUtility_MD_VC120_v5_0.lib /EXPO RT:initversion build\temp.win32-2.7\Release\cython\version.obj /OUT:build\lib.wi n32-2.7\pypylon\cython\version.pyd /IMPLIB:build\temp.win32-2.7\Release\cython\v ersion.lib /MANIFESTFILE:build\temp.win32-2.7\Release\cython\version.pyd.manifes t C:\Program Files\Basler\pylon 5\Development\lib\Win32\PylonC_MD_BCC55.lib : fatal error LNK1136: invalid or corrupt file error: command 'C:\Users\amoutenet\AppData\Local\Programs\Common\Micr osoft\Visual C++ for Python\9.0\VC\Bin\link.exe' failed with exit status 11 36

----------------------------------------

Command "c:\users\amoutenet\appdata\local\continuum\miniconda2\envs\yasmin\pytho n.exe -u -c "import setuptools, tokenize;file='c:\users\amoute~1\appdata\ \local\temp\pip-req-build-nyy4tt\setup.py';f=getattr(tokenize, 'open', open)( file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, fil e, 'exec'))" install --record c:\users\amoute~1\appdata\local\temp\pip-record- oyeuv9\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\amoute~1\appdata\local\temp\pip-req-build-nyy4tt\

alexzauritz commented 4 years ago

Hay @yasminab, did you solve your problem because i got the same issue right now?