0

I am attempting to cross-compile a Python script from my Linux platform to a Windows executable using Wine. I have successfully installed Python 3.6.0 for Windows 64 bit and pyinstaller, in addition to all of the Python dependencies for my program, inside of my Wine environment.

Running wine py my_file.py runs my program correctly without raising any errors. However, when attempting to run the cross-compiled .exe built with pyinstaller the following error is raise:

File "site-packages\pandas\__init__.py", line 35, in <module>
ImportError: C extension: No module named 'pandas._libs.tslibs.timedeltas' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
[275] Failed to execute script parser

I used git clone https://github.com/pandas-dev/pandas.git to download the Pandas source code into my Wine drive_c folder, then ran wine py setup.py build_ext --inplace --force and received the following error:

fixme:ntdll:NtQueryInformationJobObject stub: 0x54 9 0x33eff0 112 0x33efec
install requires: 'python-dateutil < 2','numpy'.  use pip or easy_install.
   $ pip install 'python-dateutil < 2' 'numpy'
fixme:msvcrt:__clean_type_info_names_internal (0x1e1f9bc8) stub
fixme:ver:GetCurrentPackageId (0x33ef18 (nil)): stub

However, running wine py -m pip freeze shows that I have the correct versions of these modules installed already:

altgraph==0.14
beautifulsoup4==4.6.0
bs4==0.0.1
future==0.16.0
html5lib==0.999999999
lxml==4.1.1
macholib==1.8
numpy==1.13.3
pandas==0.21.0
pefile==2017.11.5
PyInstaller==3.3
pypiwin32==220
python-dateutil==1.5
pytz==2017.3
six==1.11.0
webencodings==0.5.1

I can also successfully import these modules from my Python interpreter:

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dateutil
>>> print(dateutil.__version__)
1.5
>>> import numpy
>>> print(numpy.__version__)
1.13.3
>>> 

What is preventing me from building Pandas inside of my Wine environment?

Tetra
  • 153
  • 10
  • 1
    I have been [experimenting a lot with Python on Wine](https://github.com/pleiszenburg/zugbruecke) - I am surprised to see that you managed to install and run CPython 3.6 on top of Wine in the first place. There was [a bug in Wine which prevented running CPython 3.6](https://bugs.winehq.org/show_bug.cgi?id=42474) AFAIK for quite some time. A patch was only recently added to Wine-staging. The error(s) you're seeing are new to me, but I'd still like to suggest to try 3.5.x. CPython 3.6 was modernized in terms of Windows API usage, probably causing your problem, too. Could you check? – s-m-e Dec 18 '17 at 12:16
  • @s-m-e After fiddling around for a while with no success, I've shelved my efforts to get my script to cross-compile for the time being. The CPython 3.6 issues are a big headache. I'll let you know if I can get this working on 3.5 once I get around to working on this again. – Tetra Dec 21 '17 at 04:39

1 Answers1

0

I know I'm late, but hopefully this will still be helpful and/or point others in the right direction.

This problem results from a hidden import in pandas/a missing hook in pyinstaller. It's solved by adding this hook file in drive_c/Python*/Lib/site-packages/PyInstaller/hooks. It's discussed in this github issue and resolved by the link above.

I was able to find the answers here and here in other Stack Overflow questions.

Once I got this resolved, I started getting an error related to numpy (I don't remember exactly what it was, I think it involved dates and it was in the importing of numpy or pandas because I was using a test .py that did essentially only that) which resolved by uninstalling and reinstalling pandas with pip (using, in my case, "wine python.exe ./Scripts/pip.exe uninstall pandas" while in /path/to/drive_c/Python27). Lastly, I found this site helpful for understanding how to work in the wine environment (e.g. how to use pip in wine).