Pyinstaller error- requires at least one scriptname file - python

after trying to build a standalone by entering
python pyinstaller.py -F myscript.py
in the pyinstaller directory i get an error:
error: Requires at least one scriptname file or exactly one .specfile
I have the script in the same directory as the pyinstaller. What might be causing the error?
EDIT: To answer the comments: I run the command from the same directory as pyinstaller. I can access both files.

Try adding -m after python.
Also, from what I have seen, and tried, "pyinstaller.py" doesn't work, but after removing the ".py" it works
So, perhaps you can try the following:
python -m PyInstaller -F myscript.py
Note: 'PyInstaller' in this case is case sensitive, it doesn't work if you just use 'pyinstaller'
'pyinstaller' does work however in the following case: pyinstaller -F myscript.py

Related

How do I run a setup.py file without being in its directory?

To install a package that includes a setup.py file, usually you cd into the root directory where setup.py is located and then run the following:
python setup.py install
Now my problem is that I'm building an addon for another application, and while I can install "normal" package via code with the following:
subprocess.run([sys.executable, "-m", "pip", "install", package])
I also have to install a couple custom made packages, and if I try to do it like this:
subprocess.run([sys.executable, "-m", "/MSN-Point-Cloud-Completion-master/emd/setup.py", "install"])
I get the following error: Error while finding module specification for 'MSN-Point-Cloud-Completion-master/emd/setup.py' (ModuleNotFoundError: No module named 'MSN-Point-Cloud-Completion-master/emd/setup')
What is annoying me is that if I manually cd into the directory and simply run python setup.py install from the cmd it works just fine.
So the problem seems to be passing the relative path to the setup.py file, but as I said, considering this is an addon I need to install that setup.py from code. Any solution?
Reading comments made me realize a few mistakes.
First of all I realized that I shouldn't use -m flag in this case and this allow me to execute setup.py correctly. Also deleted the extra slash in the path and now the following works:
subprocess.run([sys.executable, "MSN-Point-Cloud-Completion-master/emd/setup.py", "install"])
However, since I wasn't in that directory still, I also got the following error c1xx: fatal error C1083: It is not possible to open file: 'emd_cuda.cu': No such file or directory and the compilation failed.
This definitely fixed all the problems:
import os
import subprocess
os.chdir("MSN-Point-Cloud-Completion-master/emd/")
subprocess.run([sys.executable, "setup.py", "install"])

pyinstaller: error: the following arguments are required: scriptname

i am trying to make a simple executable file using pyinstaller. by following the steps given in link blow.
[https://datatofish.com/executable-pyinstaller/]
but at step 5 i am getting the error for using command
"pyinstaller --onefile -main"
pyinstaller: error: the following arguments are required: scriptname
my file name is main and it containt only one line
print("hello world")
pyinstaller --onefile -main.py
With pyinstaller it is good practice do rename your file to main.py. Also if you are using GUI, you will probably want -w argument which means without a console.
As the error suggests, you are missing the file name.
try doing it like this.
pyinstaller --onefile main.py
although you are making simple executable file of one line code, it is the most simple case. for this you should try this
"pyinstaller main.py"
the other parameters are used for most complicated code where different libraries are used.
if yet not satisfied just read documentation.

how to solve fbs error 'Can not find path ./libshiboken2.abi3.5.13.dylib'?

I have been able to freeze a Python/PySide2 script with fbs on macOS, and the app seems to work.
However, I got some errors from the freeze process stating:
Can not find path ./libshiboken2.abi3.5.13.dylib.
Does anyone know how to fix that?
Try to use the --runtime-tmpdir because while running the generated exe file it needs this file libshiboken2.abi3.5.13.dylib and unable hook that file.
Solution: use --add-data & --runtime-tmpdir to pyinstaller command line.
pyinstaller -F --add-data "path/libshiboken2.abi3.5.13.dylib":"**PATH"
--runtime-tmpdir temp_dir_name your_program.py
here PATH = the directory name of that file looking for.-F = one file

make: f2py: No such file or directory

I am running Mac OS X 10.10. I have some python code I have inherited. I need to run "make" in a certain directory, because I get a warning when I run my python script along the lines of WARNING: failed to import test1lib. Please run make in /this/directory/ So I go to that directory where I find the following files:
Makefile __init__.py __init__.pyc foo.py foo.pyc foo_code.f foolib.f
So I run $ make
but I get the following error:
f2py -c foolib.f -m foolib
make: f2py: No such file or directory
make: *** [foolib.so] Error 1
Running which f2py returns /usr/local/bin/f2py so its not like I don't have f2py, but why is my terminal expecting f2py to be a directory? What can I do so that I can run make on this case?
If you have f2py, then it's either not on the search PATH, or it has not been made executable.
I don't know if you are on Linux or Windows. Try to execute f2py manually and see if it starts. If not, try to locate it, and see where it is installed.
If you can start it from the command line, then show us the Makefile around where the command f2py is located.
EDIT: Ok... I'm suspecting that f2py is actually a Python script, and it has a shebang line (first line starts with #!) which calls for a python version you don't have. In my system, f2py start with:
#!/usr/bin/python
which calls python2.7.x... If you have python3, then f2py may not find it. Do you start Python with the python3 command?
Note: It seems like f2py doesn't come for Python3 ('f2py3' or so).
Note: The error message you mention can come from a wrong shebang line at the start of f2py (the shebang is the first line of the f2py executable - which is just a Python script). Normally it is
#!/usr/bin/python
or maybe
#!/usr/local/bin/python
if you compiled Python yourself. If it's neither of these, start suspecting. Maybe f2py was installed by some confused tutorial or demo.

"Cannot access setup.py: No such file or directory" - can't run any .py files?

This problem started while I was installing pyswip and needed to run a setup.py file. Using the command "python setup.py", I'm greeted with the following message: "python: can't open file 'setup.py': [Errno 2] No such file or directory."
I know this question's been asked a lot before, so I've tried everything in previous answers. Including #!/usr/bin/env python or #!/usr/bin/env python-3.3.0 at the very top of the script and then trying "chmod +x setup.py"
gives the following: "chmod: cannot access setup.py': No such file or directory".
Trying to run other .py files from the terminal gives the same result.
Running the file in the Python Shell from IDLE doesn't do anything.
Running the "ls -d */" command shows that the Python-3.3.0/ directory, where the .py files in question are, is definitely there.
Am I missing something really obvious? (If it helps, I have Elementary OS 0.2.)
When you run python setup.py that requires the setup.py file to be in the current directory.
You can control the current directory with the cd command.
So:
cd /home/acacia/Python-3.3.0/PySwip/pyswip-0.2.3
python setup.py install
I have no knowledge about Elementary OS but you could try to use the full path of the setup.py.
python /home/acacia/Python-3.3.0/PySwip/pyswip-0.2.3/setup.py install
[EDIT] Can't answer comments, so I just added the install parameter in my answer
You need to go into the directory that you are going to "setup". For example, if you are installing numpy, and you have git-cloned it, then it probably is located at ~/numpy. So first cd into ~/numpy, and the type the commend like "python setup.py build" there.

Categories

Resources