pycharm and pyinstaller confusion - python-3.x

I have been writing .py scripts using PyCharm in Windows 10. I want to compile them into standalone .exe so I installed pyinstaller. I believe I made a mistake by installing it via the terminal inside PyCharm instead of cmd.
Pyinstaller was initially installed in C:\Users\myuser\PycharmProjects\routine\venv\Scripts
(\routine\ is the name of the project where I keep my scripts for tasks I do on a routine basis.)
When I DIR in \Scripts, I can see pyinstaller.exe
When I run pyinstaller from \Scripts, I get the following error:
Fatal error in launcher: Unable to create process using '"c:\users\myuser\pycharmprojects\routine tasks\venv\scripts\python.exe" "C:\Users\myuser\PycharmProjects\routine\venv\Scripts\pyinstaller.exe" ': The system cannot find the file specified.
If I try to run pyinstaller from a different directory, I get this message: "'pyinstaller' is not recognized as an internal or external command, operable program or batch file."
If I try to install pyinstaller from anywhere else, I get a bunch of messages saying "Requirement already satisfied: pyinstaller in c:\users\myuser\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages"
If I uninstall pyinstaller with pip and then reinstall it, I get this message "WARNING: The scripts pyi-archive_viewer.exe, pyi-bindepend.exe, pyi-grab_version.exe, pyi-makespec.exe, pyi-set_version.exe and pyinstaller.exe are installed in 'C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH."
If I add the specified directory to PATH I still get the same message.
Any idea what I am doing wrong here, or any suggestions as to how to fix this?

Related

I cannot run pyinstaller on my computer even though I have installed it

This is the problem right here, do you have any advice for that?
installed pip and pyinstaller, but still got this error message when I tried to convert my project into an .exe.
From Pyinstaller installation guide:
If you cannot use the pyinstaller command due to the scripts directory not being in PATH, you can instead invoke the PyInstaller module, by running python -m PyInstaller (pay attention to the module name, which is case sensitive). This form of invocation is also useful when you have PyInstaller installed in multiple python environments, and you cannot be sure from which installation the pyinstaller command will be ran.
So you may run it as e.g.:
python -m PyInstaller some_system.py
Or, as the issue seems that PATH Windows environment variable doesn't include Python's Script folder, it'd better to fix it. From the same guide:
If the command is not found, make sure the execution path includes the proper directory:
Windows: C:\PythonXY\Scripts where XY stands for the major and minor Python version number, for example C:\Python38\Scripts for Python 3.8)
To fix you may run where python to get exact location of Python on your machine (let's say it shows C:\Python38\). Then add to PATH env variable Scripts folder inside it (in this example it'd be C:\Python38\Scripts\)

Executable not runing pyinstaller

My computer is runing Linux mint 20 with python 3.8
Created an executable file with PyInstaller with the following comand being in the correct PATH folder:
`python3 -m PyInstaller [filename.py] `
I had to use that command because when i tried:
`pyinstaller [filename.py]`
Got an error message stating order not found.
However it does work, it creates the excecutable but once it is created i double click it or try to open it and doesn't run.
When i run the python file with the terminal it works perfect.
I need to know what to doto get it working.
Thanks

Used pip for pyinstaller but pyinstaller still not recognized

Although I have used pip to get pyinstaller without any errors, command prompt tells me "'pyinstaller' is not recognized as an internal or external command, operable program or batch file." I also do not see any files named "pyinstaller" in my Scripts folder.
PATH seems to point to the right place. I can pip other packages successfully.
I have found the script. I located it by looking in the paths mentioned when I used pip. Then I had to place it in my already working PATH (which is just my Scripts folder in Python), and rename it to just "pyinstaller"

Running pyinstaller in a command prompt returns "failed to create process"

I am trying to convert my python file into a .exe, and I found out about pyinstaller. I ran in the command prompt:pip install pyinstaller. After a few seconds, the last line said something like "pyinstaller was successfully installed" then when I am running just "pyinstaller" in the command prompt, it prints "failed to create process.". I tried running it in the directory with the scripts, I tried doing "pyinstaller myprogram.py" in the directory of my program. I even went to windows 10, "Advanced system settings" and added the directory of my python scripts, but it always returns this "failed to create process." I looked at other questions in stackoverflow. I even looked at the first lines of scripts of the pyinstaller but they already had quotes, so I do not know what is wrong.
Any reply would be appreciated.
It seems that this is a known issue with cx_Freeze which has been resolved in the source. It will be fixed in the new release (5.1.1)
I had the same issue so I checked the file
C:\Python27\Scripts\pyinstaller-script.py
and there was an old python path which when I installed python installer
C:\Python27\python.exe
But later I renamed python.exe --> python2.exe, so I just changed the path
C:\Python27\python.exe --> C:\Python27\python2.exe
in file
C:\Python27\Scripts\pyinstaller-script.py
and it worked perfectly.I would also suggest check you environemnt variables too carefully.

Getting error in installing rpy2 on windows

I am trying to install rpy2 package and getting following error both with
C:\python27>easy_install rpy2
Searching for rpy2
Reading http://pypi.python.org/simple/rpy2/
Reading http://rpy.sourceforge.net
Best match: rpy2 2.3.3
Downloading http://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.3.tar.gz#md5=6cd95eb70645577cb53198ef0a32395e
Processing rpy2-2.3.3.tar.gz
Running rpy2-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\chetan~1\appdata\local\temp\easy_install-wfxip9\rpy2-2.3.3\egg-di
st-tmp-rrezfb
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
C:\Python27\lib\site-packages\setuptools\command\easy_install.py:921: RuntimeWarning: tp_compare didn't return -1 or -2 for ex
ception
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
error: Setup script exited with Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
And when I try pip this is what I get
c:\Python27\Lib\site-packages\django\bin>pip install rpy2
Downloading/unpacking rpy2
Running setup.py egg_info for package rpy2
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
I spent a few days on this too... then I stumbled upon this thread, where a link is given: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
On this page you can find (amongst other useful things) a pre-compiled version of rpy2 for Windows, and for different versions of Python. It apparently only works for R 2.15.3, I did not try it with other versions.
The error
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
is probably caused by the absence of unix like tools in windows. (you might also have had an error like
'sh' is not recognized as an internal or external command, operable program or batch file
I finally got it to work on windows 7 by installing Rtools and mingw compiler and changing the setup.py and unixccompiler.py file. See rpy2 install on windows 7
Also the error
%load_ext rmagic
RuntimeError("Unable to locate R.dll within %s" % RHOME)
is caused by rpy2 not able to find R.dll correctly in the code. You can add R_HOME environment variable as eg C:\Program Files\R\R-3.0.2 the outside folder (for details see the link).
Hope this helps..
Recently had to attempt to build this from source. Got the rpy2-2.2.2 version so I can use with with Python 2.6.6 on Oracle Linux.
The solution to getting this to work was to fix a couple of things in the setup.py script.
First, allow get_rconfig() to allow empty strings. If there was a way to flag this, it wasn't obvious to me:
config = RConfig()
for about in ('--ldflags', '--cppflags',
'LAPACK_LIBS', 'BLAS_LIBS'):
#config += get_rconfig(r_home, about)
config += get_rconfig(r_home, about, allow_empty = True)
Secondly, fix a bug with the dropthrough in RConfig.from_string, where it was referencing a non-existent variable:
elif rconfig_m is None:
if allow_empty:
#if allow_empty and (rconfig == ''):
print(cmd + '\nreturned an empty string.\n')
This then allows the R CMD config loops to get parsed and the empty cases (which you will probably encounter if your R build was not built as a shared library) and I am able to complete the cycle with
python setup.py build install

Resources