No module named 'pandas._libs.tslibs.timedeltas' in PyInstaller

no module named error python3
python no module named same directory
importerror: no module named mac
importerror: no module named linux
modulenotfounderror: no module named 'config'
modulenotfounderror: no module named 'error'
python no module named requests
no module named weather

I am trying to wrap a Python script into an exe using PyInstaller (development version) for windows.

The script uses Pandas and I have been running into an error when running the exe.

Traceback (most recent call last):   File "site-packages\pandas\__init__.py", line 26, in <module>   File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)   File "site-packages\pandas\_libs\__init__.py", line 4, in <module>   File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)   File "pandas/_libs/tslib.pyx", line 1, in init pandas._libs.tslib ModuleNotFoundError: No module named 'pandas._libs.tslibs.timedeltas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "G5k Version file Extract (with tkinter).py", line 15, in <module>   File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)   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.

I have tried doing this for programs without pandas and everything was fine.

This is very similar to another question already solved for Python 2, but I am using Python 3 and that solution does not apply the same way due to the changed .spec file format.

Python 3.6 PyInstaller - version 3.3 Pandas - version 0.20.3

PyInstaller 3.3, Pandas 0.21.0, Python 3.6.1.

I was able to solve this thanks to not-yet published/committed fix to PyInstaller, see this and this. AND keeping the ability to pack it into one executable file.

Basicly:

  1. Locate PyInstaller folder..\hooks, e.g. C:\Program Files\Python\Lib\site-packages\PyInstaller\hooks.

  2. Create file hook-pandas.py with contents (or anything similar based on your error):

    hiddenimports = ['pandas._libs.tslibs.timedeltas']
    
  3. Save it + I deleted .spec file, build and dist folders just to be sure.

  4. Run pyinstaller -F my_app.py.

This fix should work as long as you don't upgrade or reinstall PyInstaller. So you don't need to edit .spec file.

Maybe they will include the fix sooner for us! :)

Traps for the Unwary in Python's Import System, While Python 3.3+ is able to import the submodule without any problems: File "​<string>", line 1, in <module> ImportError: No module named 'example.foo'. /usr/bin/python: No module named zeep. I have already run . pip install zeep and it successfully installed. However, this command keeps failing. I am running these commands on a remote (ssh) server with python 2.7.

I'm not sure it may help you but following the solution on the post you mention work for me with python 3.6 pyinstaller 3.3 and pandas 0.21.0 on windows 7.

So adding this to the spec file just after analysis :

def get_pandas_path():
    import pandas
    pandas_path = pandas.__path__[0]
    return pandas_path

dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
a.datas += dict_tree
a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)

Also my spec file format is the same as the one in the post you mention.

Python error “ImportError: No module named”, To get rid of this error you just need to create __init__.py in the appropriate directory and everything will work fine. To know more about this you  It will list a bunch of modules in the email module, but none of the MIME modules are there. I can see them from WindowsExplorer in the same lib folder as all the other modules. After searching other questions I did see that I had named my test program 'email.py' which I see now is a big no-no.

I managed to solve this problem by using the "--hidden-import" flag. Hopefully this can be helpful to someone else that comes across this thread.

pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas myScript.py

ImportError: No module named 'XYZ', ImportError: No module named 'XYZ'. Jupyter notebook cannot find the package you already installed? Let's solve the problem. If you have tried all methods provided above but failed, maybe your module has the same name as a built-in module. Or, a module with the same name existing in a folder that has a high priority in sys.path than your module's. To debug, say your from foo.bar import baz complaints ImportError: No module named bar.

If you are using Anaconda, it is highly likely that when you were trying to uninstall some package it has disrupted pandas dependency and unable to get the required script. If you just run conda install pandas you might end up with another error:

module 'pandas' has no attribute 'compat'.

So, try uninstalling and reinstalling pandas conda uninstall pandas, Install it again using conda install pandas this will solve the problem. On the other hand, if you are not using Anaconda., try doing the same on Command prompt pointing to Python scripts folder pip uninstall pandas & pip install pandas.

Most of the times, this should solve the problem. Just to be cover all the possibilities, don't forget to Launch Spyder from Anaconda after installing pandas.

ImportError: No module named github · Issue #856 · PyGithub , I'm trying to use PyGitHub and I'm getting "ImportError: No module named github". Setup specs: macOS v10.13.6 Python v3.7.0 Installed with  No module named '_tkinter' configured. 2 Answers 2. The IDE tells you that your python is not confingured for Tk (tkinter), which is your problem. While I am not certain on how to fix this becuase I never use turtle or Tk, I have a few ideas.

ModuleNotFoundError: No module named 'inferior' · Issue #27 , ModuleNotFoundError: No module named 'inferior' #27. Closed apt install gdb python-dbg python2.7-dbg ➜ pip install --no-cache-dir pyringe  Traceback (most recent call last): File "", line 1, in ImportError: No module na Stack Exchange Network Stack Exchange network consists of 175 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

ImportError: No module named error, ImportError: No module named error[/inline] Could this be a problem with something in the script, or my Python configuration, or some quirk  ImportError: No module named tensorflow - Can't install Tensorflow-3. Successfully installed Tensorflow-GPU, After “import tensorflow” nothing will be printed out. 0.

ModuleNotFoundError: No module named 'CommandNotFound , Whenever I try sudo apt update I got: Traceback (most recent call last): File "/usr/​lib/cnf-update-db", line 8, in <module> from  Stack Exchange Network. Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Comments
  • I believe this is fixed in pyinstaller 3.4 - the hook is there out of the box. See linked issue.
  • I was getting recursion errors today even with the hiddenimports stuff, and I figured that if all else fails, just including the whole pandas folder would probably be a viable solution, similar to how matplotlib provides a data files list. This looks even better or equivalent. I won't get a chance to try it until Monday, but wanted to say thanks until then.
  • @Simon -- After using your suggestion, my program worked great for me with console=True, but it is not working when the console=False. But, when I say True I get the black command window at the end along with my wanted exe window which is not required. When I try deleting the black window my desired window also get closed. Can you please suggest me!
  • You can use some basic formatting to distinguish what is just text and what is meant to be run etc, like print("Hello")