Create python executable: PyOS_InputHook is not available for interactive use of PyGTK

11

I just finished my first program with python and would like to create an executable for distribution. However, I'm having a hard time doing this. I've tried using py2exe , pyinstaller and cx_freeze to no avail. After reading many opinions about it, I believe the best solution for my case is to use the pyinstaller , but I am not able to make the .exe file it creates work.

The imports I make in my program are below:

import os
import pygtk
import gtk
import MySQLdb
import getpass as gt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.io import sql
from scipy import stats, integrate
from scipy.optimize import curve_fit
import seaborn as sns
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import train_test_split
from sklearn import metrics

Reading the documentation for pyinstaller I've seen that the only libs it does not support are scikit-learn ( sklearn ) and seaborn . When I use pyinstaller --onefile Principal.py the dist and build folder is created, but when I try to run the .exe file I get the following error message:

  

C: \ Users \ Lucas \ AppData \ Local \ Temp_MEI82242 \ gtk__init __. py: 127: RuntimeWarning:        PyOS_InputHook is not available for interactive use of PyGTK       Traceback (most recent call last):         File "", line 13, in         File "c: \ users \ lucas \ appdata \ local \ temp \ pip-build-6fpfyh \ pyinstaller \ PyInstall       er \ loader \ pyimod03_importers.py ", line 363, in load_module         File "c: \ users \ lucas \ anaconda \ lib \ site-packages \ pandas__init __. Py", line 13,       in           "extensions first.". format (module))       ImportError: C extension: lib not built. If you want to import pandas from the s       ource directory, you may need to run 'python setup.py build_ext --inplace' to bu       ild the C extensions first.       Principal returned -1

Can anyone give me a light on how to do this?

    
asked by anonymous 21.12.2015 / 02:20

1 answer

1

Taken directly from a issue of the pyinstaller :

  

fixed this issue on my end. Pyinstaller was not including $ PYTHONDIR / site-packages / pandas / lib.so 'just copied this into the dist directory and named it pandas.lib.so and it appears to be working. Pyinstaller is awesome keep up the good work!

Changing in kids, copy the file that line 13 of pandas__init __. py is asking for the lib.so file in $ PYTHONDIR / site-packages / pandas / , and copy to your dist directory.

According to the opening of the issue, the face also uses Windows, and this may decrease the chances of not being effective, since the questioner also has the same scenario, or very close to it:)

    
12.07.2016 / 05:46