Create python executable: Pyos_inputhook is not available for Interactive use of Pygtk

Asked

Viewed 339 times

11

I just finished my first program with python and would like to create an executable for distribution.
However, I’m having trouble doing this. I’ve tried using py2exe, pyinstaller and cx_freeze without success. After reading many opinions about it, I believe that the best solution for my case is to use the pyinstaller, but I am unable to make the file . exe that 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 of pyinstaller I saw that the only libs that he can’t stand are scikit-learn (sklearn) and seaborn. When I use pyinstaller --onefile Principal.py is created the dist and build folder, but when I try to run the file . exe 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) Import: 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. Main returned -1

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

  • Error says: > you may need to run 'python setup.py build_ext --inplace' Have you tried running this command?

  • I’ve tried yes, but what would the setup.py file be? Because for pyinstaller you don’t need to create a setup file like py2exe.

  • I would just like to leave commented that if your program is for users a little more than layman you can simply ask him to download python and run an installation script the famous setup.py, many programs are distibuted like this. If it is also for Ubuntu/Fedora users it is even easier.

1 answer

1

Taken directly from a Issue of the repository of pyinstaller:

Fixed this Issue on my end. Pyinstaller wasn’t 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!

Switching in kids, copy the file that line 13 of pandas__init__.py is asking, in case, the file lib. in $PYTHONDIR/site-Packages/pandas/, and copy to your directory dist.

According to the opening of Issue, the guy also uses Windows, and this may decrease the possibilities of not being effective such solution, since the author of the question also has the same scenario, or very close to it :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.