I've written a program that utilises the Pillow module (a PIL fork).
I would like to compile the finished program to an .exe for distribution.
I have tried compiling the program with both PyInstaller and Nuitka, however neither of these seem to support the compilation of a program that utilises this external module.
Does anyone know of any other Python compilers that support the compilation of a program that utilises the Pillow module?
Thank you
Installing Anaconda is your best bet.
Anaconda is a complete package of all python programming essentials. It also has your much needed pillow (or the so called python imaging library) built-in.
It comes with certain other python packages built-in and ready-to-use such as numpy, pandas, scipy, matplotlib, and IPython.
It also has an easy-to-use IDE namely Spyder, which is the playground. You get to do all your coding here. Spyder is just like any other text editor but with more functionality an ease of access.
If your looking out for more options in image processing, Anaconda also comes with scikit-image or skmage (also built-in)
In case you want to install OpenCV on your machine, it can be easily done using the Anaconda command prompt using this command:
conda install -c menpo opencv=3.0.0
Visit the website HERE
I decided to have another attempt at compiling my program using Pyinstaller.
Pyinstaller already worked with Pillow, however it ran into problems with programs that utilised Tix.
After a lot of trial and error, I managed to create a solution based on a comment on github.
My solution.
Related
So I have been writing a Python program that utilizes OpenCV for Windows. It's mostly just a project to learn how to use Vision-based Machine Learning. I've gotten the project working with my CPU, and while it "functions" it is abysmally slow, so I wanted to try working with the GPU version instead. Unfortunately, there isn't a python package that has OpenCV with Cuda-enabled GPU functionality (from what I could tell).
So after researching, I found that in order to do what I wanted, I had to compile the OpenCV source code with Cmake. So I set out to do so with the help of this guide which seemed to work (it compiled at least). But now i'm running into the issue of:
I don't actually know how to import this newly built package into my project's venv. I've tried moving the cv2.cp37-win_amd64.pyd into the project's venv site packages, i've tried moving the entire build folder into the project and directly importing it, but neither actually worked... so I'm a little at a loss on what to do to get OpenCV with GPU enabled CUDA working in my project.
EDIT:
I followed the guide that Miki linked, including installing Anaconda and all that jazz. The package imports correctly when I use:
Following #Miki's suggestion, I went through the guide that they linked, following all of the processes, testing that OpenCV was in fact being built correctly with:
set path=%openCvBuild%\install\x64\vc16\bin;%path%
python -c "import cv2; print(f'OpenCV: {cv2.__version__} for python installed and working')"
But it still isn't showing up in the python import in conda, despite being in the env's site-packages folder.
I am a beginner and I want to learn computer programming. So, for now, I have started learning Python by myself with some knowledge about programming in C and Fortran.
Now, I have installed Python version 3.6.0 and I have struggled finding a suitable text for learning Python in this version. Even the online lecture series ask for versions 2.7 and 2.5 .
Now that I have got a book which, however, makes codes in version 2 and tries to make it as close as possible in version 3 (according to the author); the author recommends "downloading Anaconda for Windows" for installing Python.
So, my question is: What is this 'Anaconda'? I saw that it was some open data science platform. What does it mean? Is it some editor or something like Pycharm, IDLE or something?
Also, I downloaded my Python (the one that I am using right now) for Windows from Python.org and I didn't need to install any "open data science platform".
So what is this happening?
Please explain in easy language. I don't have too much knowledge about these.
Anaconda is a commercial python and R distribution. It aims to provide everything you need (Python-wise) for data science "out of the box".
It includes:
The core Python language
100+ Python "packages" (libraries)
Spyder (IDE/editor - like PyCharm) and Jupyter
conda, Anaconda's own package manager, used for updating Anaconda and packages
Your course may have recommended it as it comes with these extras but if you don't need them and are getting on fine with vanilla Python that's OK too.
Learn more: https://www.anaconda.com/distribution/
Anaconda is a Python distribution that makes it easy to install Python plus a number of its most often used 3rd party libraries in a flexible way on a Windows or Linux machine.
My experiences with it are very positive, both on Windows and Linux. It is quite complete and avoids problems in building libraries that you need from source code, that frequently plague one by one installations of those libraries by tools like pip.
By the way: It's very wise to start with 3.5 or 3.6 since 2.7 is approaching the end of its lifecycle, though many applications still depend on it.
As for tutorials: Pythons own docs are quite suitable for learning the language.
https://docs.python.org/3/tutorial/
Anaconda is a Python-based data processing and scientific computing platform. It has built in many very useful third-party libraries. Installing Anaconda is equivalent to automatically installing Python and some commonly used libraries such as Numpy, Pandas, Scrip, and Matplotlib, so it makes the installation so much easier than regular Python installation. If you don't install Anaconda, but instead only install Python from python.org, you also need to use pip to install various libraries one by one. It is painful and you need to consider compatibility, thus it is highly recommended to directly install Anaconda.
I'm pretty new to programming, and am generally unfamiliar with how stuff like environments and distributions work.
I found myself needing to use a module in the SciPy library for python, and when the standard pip install failed, I got to googling and found that the recommended way to access these modules is to install an entirely new python distribution called Anaconda with it's own more advanced spyder IDE, more included libraries, etc.
I'm not averse to learning the new IDE, but my question is that if I want to continue using the simple and fast IDLE IDE for making scripts that make use of the SciPy modules, is there any way to get my existing Python35 installation recognize the included Anaconda modules? Or do I have to use Anaconda for all of my future programming now?
Note: I was able to get scipy seperately via http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy, but I'm still interested in using the other included anaconda modules.
My apologies if this is an inappropriate question or if it has been answered before, I searched to the best of my abilities but didn't find what I was looking for.
I'm quit new in using python. The current version I'm using is 2.7. I need to employ function mncontour in minuit which requires the installation of natgrid as additional toolkit for matplotlib. I downloaded natgrid 0.2.1 with a file named setup.py in it. I ran this setup.py through python shell without reaching any error. But it seems that the installation was not succeed. Anyone has any idea how the installation can be done? Many thanks.
Liang
Could you please provide some more information on this topic.
what operating system you are working with ( some offer more support than others for python)
have you installed python headers, and a C/C++ compiler in your environment? ( numerical libraries might require native code to speed up the computation)
Have you tried a package manager for python ( such as easy or pip)? Both work on both windows and unixes, and usually download and install all the needed packages to make your module working.
A piece of the setup's output before setup.py finished would help us help you greatly.
Python for Windows [Nt - 7] is compiled with either cygwin or mingw, thus you not only need the python environment, but also said compiler, and python headers. If you want a more point and click install, then there's this professor at this university who maintains a good and up to date repository of scientific python modules, that depend on native extensions ( among which numpy, scipy, matplotlib).
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Manuals to setup mingw and python :
https://docs.python.org/2/using/windows.html
MingW can be downloaded from here:
http://www.mingw.org/
Best option for installing natgrid is from conda
conda install -c jochym natgrid=0.2
I've been trying to connect opencv and python in both Ubuntu and Windows XP. I've failed on both.
I've read many webpages and threads about "how to install" it but none has worked (the worst part is that they all say kind of the same).
Steps (windows xp):
Installed Python 2.7 by default (works perfectly)
Installed PIL and cx_Freeze (may they
create a conflict? I don't think so
:s)
Installed Opencv 2.2 by default
(OpenCV-2.2.0-win32-vs2010.exe) and
it isn't recognized inside a py nor
as import opencv.cv nor using the
cookbook way, import cv (I skipped
the visual studio steps since I'll
use it with python)
Checked path (it's ok, it has the
Opencv2.2\bin thing)
Rechecked webpages and stuff
Steps (ubuntu):
Had python working
sudo apt-get install, cmake, make,
sudo make install, etcetc (from the
tutorials)
same thing... module not recognized
Please can you help?
Update:
I managed to install it and have it recognized by the system (I used http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv and it worked perfectly after that).
The problem now is that it crashes when I try to use CaptureFromFile. Someone else has reported it 3 days ago so now I wait.
I'll check the other wrappers, maybe one of them will work.
For windows see my web page: http://www.modernmind.org/wiki/OpenCV
For Ubuntu you should just need to apt-get install python-dev then generate the make files with Cmake, build it and then make install. In order to build the python bindings you need to have the python header files on your system and you probably don't. When you run configure in Cmake make sure that you don't see any messages at the top about PYTHON_INCLUDE not being defined.
To access a library it needs a Python library installed in the Python version you are using. From what you write above it seems to me that you install OpenCV in general, but that you don't specifically install the Python library. This is why it doesn't work.
I'm not sure how to install the Python wrappers, and the OpenCV documentation is a bit sparse on that info. But if you did build them (and that needs to be turned on explicitly, says the docs) they seem to end up in opencv/release/lib .
Look at "Testing Python wrappers" on http://opencv.willowgarage.com/wiki/InstallGuide
If there is still no luck, there is a bunch of alternative Python wrappers available: http://pypi.python.org/pypi?%3Aaction=search&term=opencv&submit=search
Maybe they are better documented.