New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute '__reduce_cython__' #3079

Closed
joelhjalmarsson opened this Issue Dec 6, 2017 · 16 comments

Comments

Projects
None yet
7 participants
@joelhjalmarsson

joelhjalmarsson commented Dec 6, 2017

pyinstaller version: PyInstaller-3.4.dev0+5f92e6d16
OS: Windows7
python version 2.7.14

This is the first time I am trying to use pyinstaller. I get no errors or warnings when running pyinstaller but when trying to execute the resulting .exe file I get the following error:

Traceback (most recent call last):
  File "drivers_notes.py", line 8, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\mdfreader\__init__.py", line 30, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\mdfreader\mdfreader.py", line 48, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\mdfreader\mdf3reader.py", line 48, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\mdfreader\mdf.py", line 26, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\__init__.py", line 26, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\_libs\__init__.py", line 4, in <module>
  File "c:\python\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 687, in load_module
    module = imp.load_module(fullname, fp, filename, ext_tuple)
  File "pandas\_libs\tslib.pyx", line 1510, in init pandas._libs.tslib
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute '__reduce_cython__'*

I am using a module called mdfreader in my program and I guess that is not supported by pyinstaller?

@htgoebel

This comment has been minimized.

Member

htgoebel commented Dec 6, 2017

Please try #2998, which solves another problem with pandas._libs.tslibs.

@htgoebel htgoebel added the hooks label Dec 6, 2017

@joelhjalmarsson

This comment has been minimized.

joelhjalmarsson commented Dec 7, 2017

Thanks for the quick reply.

I added the hook-pandas.py to PyInstaller but I still get the same error.

@htgoebel

This comment has been minimized.

Member

htgoebel commented Dec 7, 2017

Read the fine manual, it should explain everything you need. If something is missing, we'll add it.

@joelhjalmarsson

This comment has been minimized.

joelhjalmarsson commented Dec 7, 2017

Yes the manual is really fine, but I am afraid I am too much of a rookie to even know what to look for.
I might have to solve my problem in some other language if I cannot make this python app portable.

@htgoebel

This comment has been minimized.

Member

htgoebel commented Dec 7, 2017

Sorry, I mixed up your issue with another one.

You need to look at File "pandas_libs\tslib.pyx", line 1510, in init pandas._libs.tslib to find out what is happening there. Also look into your site-packages to learn whether there is a module related to what is happening there. Then add any missing modules using --hidden-imports and if this work, drop lneuhaus a note to update the hook (as the pull-request is still open).

If inspecting the code does not help, you need to use any of the tracing tools listed at https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sure-everything-is-packaged-correctly

@joelhjalmarsson

This comment has been minimized.

joelhjalmarsson commented Dec 13, 2017

I switched to python 3 and no longer see this problem. Got some other import problems instead but easier to solve than this.

@wangym1993

This comment has been minimized.

wangym1993 commented Jan 22, 2018

@htgoebel Hi there, I am having the same issue here even after adding the hook-pandas.py.

Could you please help with locating the tslib.pyx file or give other comments for debugging? I can only see .pyd files which couldn't be opened.

  File "pandas\_libs\tslib.pyx", line 1514, in init pandas._libs.tslib
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute '__reduce_cython__'
@htgoebel

This comment has been minimized.

Member

htgoebel commented Jan 24, 2018

@JenOver

This comment has been minimized.

JenOver commented Apr 16, 2018

I ran into the same issue, tried both PyIsntaller and py2exe. So, the solution is using Python 3, instead if Python 27?

@wangym1993

This comment has been minimized.

wangym1993 commented Apr 18, 2018

@JenOver Hey, I was successful after dumping site packages in the bin folder

@JenOver

This comment has been minimized.

JenOver commented Apr 19, 2018

@wangym1993

This comment has been minimized.

wangym1993 commented Apr 19, 2018

basically, you only need to put those files that was reported missing in the folder after you execute your binary file. Py2exe/Pyinstaller doesn't recognize some files @JenOver

@htgoebel

This comment has been minimized.

Member

htgoebel commented Apr 20, 2018

@wangym1993 @JenOver I suggest you to actually solve this issue so others will not run into it. Manually copying file is not a solution, but just a ugly work-around. Please see #3079 (comment), analyze the problem and create a hook solving it.

@eliaperantoni

This comment has been minimized.

eliaperantoni commented May 4, 2018

@wangym1993 I have the same issue, what do you mean by "bin folder"? There's no bin folder in my generated dist/projectname

@Hellcat1005

This comment has been minimized.

Hellcat1005 commented May 10, 2018

Please try pandas-0.20.3. It works for me.

@fctien98

This comment has been minimized.

fctien98 commented Jul 25, 2018

I try all the actions including: downgrade to pandas 0.20.3, hidden import, still not working. Is there thing I can try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment