Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PyPotrace on Windows 10

I would like to install Potrace on my Windows 10 Computer and I will be using it with python 2.7.5. I am following the installation instruction from this site.( https://pypi.python.org/pypi/pypotrace) for Windows.

What I did so far

I installed MinGW – following these YouTube instructions [https://www.youtube.com/watch?v=DHekr3EtDOA]

I also download Agg-2.5 and potrace-1.15.win64 and put these 2 folders inside C:/src (see Picture 1)

Picture 1

Issue

However, I am stuck at this specific point of the installation instructions. It says:

I extracted both packages in my C:\src folder. Both are easy to build by executing ./configure; make and ./autogen.sh; make respectively, on MSYS prompt.

picture3

I have no idea how what that means or how to do it. I did find MSYS prompt but I have no idea what to write in the prompt to complete this step (see Picture 2).

Picture2

like image 257
ben olsen Avatar asked Oct 10 '17 20:10

ben olsen


2 Answers

You are trying to build a 'C' extension in Windows. The Python docs have a basic introduction to what this means.

In practice, you need to install a 'C' build environment, then compile and link the code. You have chosen the MinGW environment, but there are others available. Given that you have instructions for MinGW, let's stick with that, so at this point you just need to run the compiler...

For 'C' applications, there is usually a complete toolchain to keep track of what files depend on others, what external dependencies you might need and the precise build settings you need to use. In this case, the libraries are using autotools. In order to invoke them, you need to run the commands that they show in the install instructions. So, for example:

cd C:\src\agg-2.5
./autogen.sh; make
cd C:\src\potrace-1.15.win64
./configure; make

If that all works fine, you should find the library files located in the directories mentioned later in the instructions. You should then be able to run your python build as per the rest of the instructions, install the extension and use it!

like image 113
Peter Brittain Avatar answered Sep 17 '22 21:09

Peter Brittain


As another option since this was a problem and even if I solved it, I couldn't be sure users of my work could also solve it, is to use a pure python port of potrace. Full disclosure, I ported this.

It's like 500x slower completing in a second or two, depending on various factors. But, since it's pure python you can be sure it'll work for anybody without any compatibility problems.

https://github.com/tatarize/potrace

Or pip install potracer I tried to make it fit the same API as pypotrace to be a drop-in replacement. I also wrote a nice command-line sister package. If I messed up anything in the API where it requires a change feel free to raise an issue. But, it'll bypass installation problems since it's purely python code.

like image 27
Tatarize Avatar answered Sep 18 '22 21:09

Tatarize