Windows 10 pyinstaller tensorflow missing modules - tensorflow

I try to deploy a model with pyinstaller and when i run it i get the following error.
ModuleNotFoundError: No module named
'tensorflow.python._pywrap_tensorflow_internal'
Tensorflow 1.7.0
cudnn64_7
CUDA 9.0
Python 3.6

You can resolve this issue by simply renaming the file _pywrap_tensorflow_internal.pyd contained in the dist folder to tensorflow.python._pywrap_tensorflow_internal.pyd.
I still have to figure out how to tell pyinstaller the "correct" module name.

( Workaround for Python 3.5 only )
Building off of Jascha's solution, a work around is to manually fetch the file __python._pywrap_tensorflow_internal.pyd from
PathToAnaconda3/env//Lib/site-packages/tensorflow/python/__python._pywrap_tensorflow_internal.pyd
and rename it into tensorflow.python.__python._pywrap_tensorflow_internal.pyd
Then this renamed file can be moved into the exe file by :
pyinstaller -F <name of python file> --add-data "pathToFile/tensorflow.python.__python._pywrap_tensorflow_internal.pyd";.
The flag --add-data takes two arguments separated by semi colon
--add-data source_path;destination_path_inside_exe

Related

plotnine is broken with matplotlib==3.6

I am getting the following error with plotnine==0.9 and matplotlib==3.6.
File "D:\Python\Python310\lib\site-packages\plotnine\stats\stat_density_2d.py", line 3, in <module>
import matplotlib._contour as _contour
ModuleNotFoundError: No module named 'matplotlib._contour'
If I downgrade matplotlib==3.5, the problem goes away.
It's discussed here and it's already fixed here Note that it's already merged to main.
It was due to a internal matplotlib call that is no longer supported and has been replaced.
So I guess you could choose between:
downgrade to mlp 3.5.3
install plotnine#main
till the next plotnine release.
Carlos's answer is correct. However if anybody else, like me, is uncertain of how to install plotnine#main, you can implement the fix rather easily:
Find the site_packages folder you python script uses. It usually is a subdirectory of the python version you are using, which can located reliably by trying to reinstall matplotlib or any other package you know you have access to, and checking the logs in the console. ex using python -m pip install matplotlib.
Go down into the site_packages/plotnine/stats directory and open up the stats_density_2d.py file in your editor of choice.
Apply & save the modifications made in the fix. Alternatively, overwrite the file with the one from the github.
ModuleNotFoundError: No module named 'matplotlib._contour'
Issues with matplotlib 3.6.1 and
plotnine 0.9.0
K.I.S.S.
in terminal:
pip show matplotlib #enables you to check version
pip install matplotlib==3.5 #revert and problem is resolved for now.
no more:
ModuleNotFoundError: No module named 'matplotlib._contour'
resolves issue for now that will stop progress...

Importing Docstrings from Python modules using Sphinx and autodoc [duplicate]

I have faced a problem with Sphinx in Python. Even if I have followed the instructions from https://groups.google.com/forum/#!topic/sphinx-users/lO4CeNJQWjg I was not able to solve it.
I have Docs/source folder which contains:
conf.py
index.rst
RstFiles (the folder which contains .rst files for each module).
In conf.py I specify the abs path in the following way:
sys.path.insert(0, os.path.abspath('..'))
In index.rst I call all the modules from RstFiles folder in the following way:
.. toctree::
:maxdepth: 2
:caption: Contents:
BatchDataContainer.rst
BatchDefaultValues.rst
BatchTypes.rst
And finally, the content of each .rst file is in the following way:
BatchDataContainer
==================
.. automodule:: RstFiles.BatchDataContainer
:members:
When I run sphinx-build I get 2 main errors:
D:\hfTools\Projects\Validation-Source\Docs\source\RstFiles\BatchDataContainer.rst:
WARNING: document isn't included in any toctree
and
WARNING: autodoc: failed to import module 'BatchDataContainer' from
module 'RstFiles'; the following exception was raised: No module named
'RstFiles'
Any ideas what might be wrong cause I have tried different things already and nothing has helped?
If conf.py is located in this directory,
D:\hfTools\Projects\Validation-Source\Docs\source,
and the project's Python modules (including BatchDataContainer.py) are in
D:\hfTools\Projects\Validation-Source\Products,
then you need sys.path.insert(0, os.path.abspath('../..')) in conf.py.
The automodule directive needs to be updated as well:
.. automodule:: Products.BatchDataContainer
:members:

Python 3.7 + Visual Studio 2107 + boost 1.69

I am trying to get boost 1.69 working with visual studio 2107. My goal is to use Numpy in C++
When I include #include boost/python/numpy.hpp
The error I am getting is:
Searching C:\boost_1_69_0\stage\lib\boost_python37-vc141-mt-gd-x32-1_69.lib:
1>LINK : fatal error LNK1104: cannot open file 'boost_numpy37-vc141-mt-gd-x32-1_69.lib'
I am pretty sure that I have this file in this directory.
My architucture in the project is x86, 32-bit addrressing
I built boost as follows:
.\bbotstarp.bat
.\b2 -j8 --toolset=msvc-14.1 --build-type=complete link=static runtime-link=static architecture=x86 address-model=32 stage --with-python
I added the include and link folders to the project.
I do not use precompiled headers
Is there anything that I am missing?
Thanks
I had the same problem. It seems like Boost python is not supported by python 3.7 vert well.
Using python 3.6 will solve this problem.
I have been looking at this issue for months and finally figure out the root cause and solutions. The root cause that boost numpy is not built is because numpy is unable to be imported when ./b2 checks for numpy. As a clue from this post Using boost numpy with visual studio 2019 and python 3.8, you can append --debug-configuration to see the debugging information of boost python building process like this in my PC
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command 'C:/Anaconda3_Install_Root/envs/my_envs/python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
And, the error comes from ImportError for some reason:
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
After looking at this post numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found), I found this import process has to be under python environment such as under conda environment or PyCharm terminal (They both work in my PC) with all the required PATH to be imported. Now I can generate numpy static library with Python 3.8, VS 2019, boost v1.74, Windows 10. The command I use to build boost python is .\b2 --with-python python-debugging=off threading=multi variant=release li
nk=static address-model=64 stage --debug-configuration. Hopefully, that will work in yours.

Why I am getting error as "ImportError: No module named pyPdf" even after installing PyPdf3

I am trying to customize a module in Odoo 10. And I have created a addon path for the new module but I have no good right!
I am getting error "ImportError: No module named pyPdf". Since I am beginner on coding industry I find difficult to sort out this issue. Can anyone help me to sort out this issue?
Python3 support was introduced in Odoo 11, IIRC. So just try to install pyPdf for Python2.
This is usually a path problem. You should check that the directory containing pyPDF is on the Python path.
> # Print a list with the directories in the Python path
> import sys
> sys.path
Note: If you are running Odoo under a python virtual environment activate it first.
Try to run using python2
Try this on the terminal,
python2 path_to_odoo_folder/./odoo-bin

How to use pyinstaller generate a pyqt5 sotfware?

I'm using pyinstaller to generate a executable pyqt5 software in ubuntu 16.04,but i got some trouble,how do i fix it?
My os is Ubuntu16.04LTS,and python version is anconda3 python3.6.5,
my pyqt5 is using pip to install,which show in pip list is 5.11.3,and qmake version is 3.1.
I add the anconda's lib dir into my LD_LIBRARY_PATH(if not,when i run pyinstaller myfile.py it shows "TypeError: expected str, bytes or os.PathLike object, not NoneType"),and i can successfully get my executable pyqt5 software.
BUT,when i run my executable app,something goes wrong,which is
what should i do?Thanks a lot for your help!
ImportError: /home/kanghao/dabao/dist/train_tool/libQt5Core.so.5:
version `Qt_5.11' not found (required by
/home/kanghao/dabao/dist/train_tool/PyQt5/QtCore.so) [11591] Failed to
execute script train_tool
my code is in webpage:https://blog.csdn.net/yourgreatfather/article/details/85063787
I expect my code can become a executable sotfware.