jGRASP wedge: could not execute python3 - python-3.x

I am trying to use jGrasp to run python3 for debugging purposes, but it is throwing the error below when I try to run my program I have downloaded python3 and I made sure it works in the terminal, but for some reason it is not working in jGrasp. It might have something to do with the PATH but I don't know what location I should add for jGrasp to be able to execute it properly.

The Python path should end with "bin", not "bin/python3". Paths need to be directories that contain executable files, not the executable files themselves. Whether you have added this path in jGRASP only, or at the OS level, you need to change it.

Related

How can I create a Python executable program that doesn't force the user to actually download Python libraries and that stuff in order to be executed?

Let's say that I already built a program that essentially takes some images from an user's path and make new ones using the following libraries/modules:
os itertools pandas PIL
What I need now is to make that program become an executable file that can be actually executed without having to have installed the Python environment and the libraries used in the code, because the user would not know how to code, and would not likely matter how the code works.
The program would run on Windows OS (PC) only , and would use the cmd.exe as the interpreter and medium for user inputs and results display.
Solved here
You can use wheel, and ship whole environment.
#Vincent Caeles:
"#rh979 a wheel is not meant to have all dependencies. Subsequently you could do pip install path/to/wheel.whl --target /path/to/some/folder and zip the contents of the 'folder' to have all your dependencies in the zip archive and ship that to the environment where you want to run your code.
"
Another options is pyinstaller library, according to documentation it should do what you need.

Run a python script with Popen with PyInstaller

I need to run a script inside a Popen inside a packaged project (with pyinstaller). The command NEEDS to run in python3 and I (obviously) need it to be portable, which means that I can't rely on the config (python/python3 notation) used on the machine I've used to generate the package neither the one where I am using it (I can't also guarantee that there will be any python in the deployment machine...).
I have computers where python is already the correct version, and others where the correct one is python3. I tried to insert #!/usr/bin python3 in the beginning of the file and then run as python but it didn't work.
subprocess.Popen(['python', 'internal.py', arg1, arg2], universal_newlines=True)
In the non-frozen environment I am able to run using sys.executable instead of python. I tried to "pyinstall" the internal.py then, "pyinstall" the rest copying the internal folder to the new folder and then call:
subprocess.Popen(['./internal/internal', arg1, arg2], universal_newlines=True)
But this doesn't work... In the console (moving to the bigger project folder) it does, but when running the package, it doesn't...
Any idea?
Ps. I can't just import the script as a class or whatever. I can't modify system environment vars (except the ones inside the pyinstaller thing...)
I saw something about the PyInstaller.compat that has a exec_python and a __wrap_python, but I couldn't use it I get errors when trying to run the package due to pkg_resources.DistributionNotFound: The 'PyInstaller' distribution was not found and is required by the application, I tried to create a hook, to add as hidden import... None worked (but the hook part maybe I got it wrong...)

Different os.Getenv("PATH") results from shell and double-click executable

In my Go program I call os.Getenv("PATH") on Linux (Debian) and I get different results when running the program from within the shell or when double-clicking the executable icon in my file browser or on my desktop.
I have edited my ~/.profile to include the go binary in the PATH like so:
export PATH=$PATH:/usr/local/go/bin
as suggested the Getting Started Go instrutions.
When I run my os.Getenv("PATH") program from the shell it outputs:
/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin
but when I run it by double-clicking the executable file it outputs:
/usr/local/bin:/usr/bin:/bin
This suggests that double-clicking an icon will not initialize the variables with the profile commands. How can I now get the PATH that I want, i.e. including the additional directories, from my Go program?
It depends on what PATH you want.
Your program gets environment variables from the context it was executed from.
You need to modify your PATH variable for your system to "know" about executables provided with the Go release. And you usually don't need 'usr/local/go/bin' PATH when you already have a compiled binary file.

Pycharm and Python Paths on Windows with Conda

I am working with multiple versions of Python, so I don't want to put any one of them in my windows path. I discovered that I can create a virtualenv (under Settings -> Project: X -> Project Interpreter and that will allow me to specify which python exe to use, but also where to get other useful programs, like pip. The end result is that using Virtualenv I can type "pip" or "python" in the terminal in Pycharm and use it as a regular terminal.
But now I'm working with Anaconda so I don't want to use virtualenv and I want to use conda instead. This works fine, but it doesn't seem to put anything into the path. (This is particularly important because where I intend to keep my project is not near my path to the python environment conda created.)
So if I type "pip" or "python" in the pycharm terminal, it doesn't recognize them. I have to specify a huge path to get it to work right.
I've been googling around and trying to find a solution to this problem. I've found a number of supposed solutions, but so far none have worked.
So, for example, I've already tried Add Content Root under project structure. This does nothing. I've tried add local, which seems to just screw everything up. (Presumably this is a way to create a local environment that I shouldn't be touching in conda.) I've tried adding a PathConfig.pth file. So far nothing works.
Remember, I don't want to add anything into the windows path (which obviously would solve my problem) because then it won't know which specific environment I want at the moment.

cygwin binary exec format error

I have a script file that I was given to run in windows using Cygwin. When I try to use this file I get the following error
-bash: /sigdet/filename: cannot execute binary file: Exec format error.
sigdet is the folder within the Cygwin directory that I have the script. Rawdata is the name of the directory with the raw data files that the script is supposed to analyze.
To try and solve this, I have changed the file permissions, I have checked to make sure that it is on a 64 bit machine and the script appears to have compiled on a 64-bit machine. After these steps, I don't know what else the problem could be. Here are the commands I've entered:
I first changed the directory like so:
$ cd /sigdet/
Then I ran the script that is suppsed to work:
$ /sigdet/filename -i rawdata
Does the script file need to have an extension in windows? I've tried changing it to a .sh extension with no luck. I'm told that it just works on other windows machines just how it is.
Thanks to anyone that can help with this.
Your file is not an executable. It most probably contains ELF executable which is designed for Linux operating system, or it's corrupt.
If your file was a shell script, or in fact anything that contained plain text, you'd get different errors (such as, "expected command name" or "unknown command: XYZ" etc.)
Scripts are not supposed to have file extensions, like any executables. On the other hand, they should have shebangs: small text located in the first line that tells the system the path to the interpreter. For example, a Python executable script might be named whatever and have #!/usr/bin/python3 or similar in the first line. When you run it through ./whatever in the shell, it'll look for python3 in /usr/bin and run your file like this: /usr/bin/python3 ./whatever. (In fact, thanks to this you can also specify additional parameters that get passed to the interpreter.)
There is also a chance that your script is valid, but it contains a shebang pointing to bad interpreter. If that is the case, then most likely the path is correct, otherwise you'd get /whatever/interpreter: bad interpreter: no such file or directory error or similar. But then, all the other points apply to the interpreter (which is just another executable...)
If the script and/or interpreter was meant to be executed on Windows or Cygwin at least, it should either contain aforementioned shebang (#!/path in the first name) or it should be Windows executable (in which case the file data should begin with MZ letters, you can inspect it in notepad.) If it isn't, it means the files you were given can't run on Cygwin.
Had this same problem. Added the following at the top of makefile:
export ARCH = CYGNUS
What happened during the make process is that Linux and Windows versions of the executables were created. You just have to use ./.exe versions.
In my case, I got the error when I used a wrong command to compile my C program. When I used the right command:
gcc myprog.c -o myprog.exe
the error was resolved.

Resources