PyInstaller EXE not executing - pyinstaller

I have created an executable file from .py using PyInstaller. My python file contains the packages PySAM, pandas and os. Although the executable has been created successfully, while running it aborts before/while importing the packages and closes. I believe this is due to the PySAM package. I am looking for a solution such that the executable runs the entire code
Thanks in advance!

Related

'cfgrib' is not showing in xarray engine list, when the python code is packaged with pyinstaller to get exe file

I am trying to create an executable file from python code with 'Pyinstaller' package. The code runs in conda environment where the cfgrib selfcheck is good:
Found: eccodes v2.27.0.
your system is ready
However when the executable created by pyinstaller runs, the error is:
ValueError: unrecognized engine cfgrib must be one of: ['scipy','store']
I adde 'eccodes', 'python-eccodes', 'cfgrib', 'netcdf4' to the hidden imports, but no success. Does anybody have any idea to fix this issue!

Module not installed

I am writing a Dataframe to a Parquet file with Dask using the following code:
df.to_parquet('Filepath', engine='pyarrow')
Pyarrow module is required to run this code and it runs fine on my editor.
But when I package the code using Pyinstaller and try to run the .exe file I get the error
'pyarrow' not installed
How to fix this?
Note - I'm using the same python environment for Pyinstaller as well as my editor.

Compiling R from source: RStudio doesn't find the libraries if started directly

I have compiled R 4.1.0 from source against the Intel MKL.
I have put:
source /opt/intel/oneapi/mkl/latest/env/vars.sh intel64
in ~/.bashrc.
If I open a .R file with RStudio, no problem.
But if I open RStudio directly, it is unable to start R correctly, giving me the error:
/usr/lib/rstudio/bin/rsession: error while loading shared libraries: libmkl_gf_lp64.so.1: cannot open shared object file: No such file or directory
Why is that? Doesn't RStudio run ~/.bashrc when started directly?
I am running Fedora 34 Workstation.
When shared libraries are stored in "non-standard locations" we have to tell the dynamic linker about it. That is sometimes done in the calling script (often the case with bundled software, e.g. when you download RStudio which ships with a fair number of local builds of shared libraries) but a more general solution is to tell ldconfig via its configuration.
Older systems used a line per directory in /etc/ld.so.conf. Newer systems generalize this (like many other configurations) with a directory containing small files with entries. So you can create a file named, say, /etc/ld.so.conf.d/local-mkl.conf, and place the directory path in there. If you then run sudo ldconfig all applications will know about it -- including R and RStudio calling R.

Pycharm IntelliJ R extension cannot find R interpreter

After opening a .R file in Pycharm and trying to run the R code, the error R Console Failure: Cannot run console until path to viable R interpreter is specified appears. The R language plugin is installed, as is R for the computer, but PyCharm File -Settings -Languages and Frameworks does not show R (screenshot ). RStudio runs the R code in the file without problems. PyCharm used to run it, but after closing and reopening PyCharm, the file no longer runs.
I did the Edit Configurations that PyCharm asked and specified a .R configuration: the file is my open file that I want to run, the file directory is the working directory.
The file in question is an existing file initially created in RStudio. It is not a PyCharm project.
Ubuntu 18.04 on Dell Latitude E 7470.
Restarting PyCharm worked for me.
I was working on a Python project. Then I decided to change to an R project, opened it, and then opened some R files in PyCharm. That's when the error appeared.
I restarted PyCharm and upon reopening it, the R files were all there and the R console was working.
I just encountered a similar problem. I think the issue was that when I created the project in Pycharm. I did not initially choose to create the project as an R Project or R Package. Not sure if it's possibly to work around this if the project was initially designed with Python.
Copying the R file to a folder with a previously working PyCharm project (with a main.R file) and then opening it in PyCharm, the code in the file ran. The problem was solved, but it reappeared after the computer went to sleep and was wakened.
The file in the folder of the working PyCharm project no longer ran, but generated the original error. Closing the file in PyCharm and reopening did not work. Closing PyCharm and then doubleclicking the file to open it and PyCharm together worked: the code in the file ran.

Can I get source code from PyInstaller generated package?

Seems the PyInstaller put all the python script into the executable file, and when run this file, it start PyInstaller bootloader first, then prepare a temp python environment add run the scripts.
So I wonder whether my source code are safe. Can I get the source code from the package when running the executable file?
PyInstaller includes the byte compiled (.pyc) files of your program but not the original source (.py) files. You don't even need to run the executable to get the .pyc files. There are more or less working Python decompilers that turn compiled byte code (.pyc) into equivalent source code (.py).
You need to assess whether this protection is good enough for your purposes. However as a friendly suggestion, I recommend first inventing/writing something that people will want to copy before worrying about how to protect it.

Resources