How to run a makefile - Python - Speciteller - python

I have a large database of text which i want to analyze on it's sentence specificity. I want to use the tool 'Speciteller' for that, using Python. Link to the tool:
https://github.com/wjko2/Domain-Agnostic-Sentence-Specificity-Prediction/tree/master/python
One of the dependencies is to make sure to have liblinear.so. in the python/ directory. If not, i can execute a makefile - 'type make in /python' . I opened my Anaconda Prompt to execute this command, but it doesn't work. It says it is not recognized as a command, operable program or batch file.
I have already been looking how to specifically execute makefiles in Python, but i have a hard time finding the answer. Does anyone has some advice?
Note: i am still a beginner concerning Python.
Thanks in advance!
EDIT: Bump - anyone has any idea?
Edit: Operating on a Windows system

In the meantime this problem has been solved. A new update was released and additional code was provided to run it in Python smoothly. See the following repository:
https://github.com/wjko2/Domain-Agnostic-Sentence-Specificity-Prediction

A Makefile is a way to describe to a computer the steps of the compilation process of a program. To use a Makefile, on an Unix-like system (Linux, MacOS, etc.) one need to have the program make installed on their computer, and then, in a unix-shell (and not powershell like the anaconda prompt), run the command make.
However Windows does not know natively how to process those files, as the program make is not available by default on Windows. You can use a tool like WSL that let you run command designed for GNU/Linux on Windows. (I recommend installing Ubuntu 18.04). Going this route means that you will probably need to reinstall anaconda inside WSL though.

Related

Is it possible to run python scripts without python installed in Linux?

I once did something similar under windows, copying the whole python and specifying PYTHONPATH by a .bat script to make it work locally.
But today I got a Linux server that has a strict working environment and won't allow me to install anything. And unfortunately I know little about Linux. I wonder is there a similar way that I can run python on the server?
Yes, you can use python docker images for running python scripts.
I've built stand alone executables using pyinstaller. It works well. I've only used it to deliver into Linux so far.
Sorry, I cannot put a comment because of my low reputation.
In short, you cannot run a Python script directly without the interpreter installed. Fortunately, you can install a Python environment without root permission by using Miniconda (or Anaconda), then make a virtual environment and install the required packages to run your code locally for your use only.
This answer is to leave some reference for the subsequent people who encounter the similar situation.
If you choose to package via pyinstaller. Here is a good method. Almost no different from writing python. How to pack a python to exe while keeping .py source code editable?
NOTE: But there is some bad news, such as the glibc version issue. If you encounter this problem, you can refer to Pyinstaller GLIBC_2.15 not found

Python standalone .py or external import of module? Is this really as hard as it seems?

Situation: I've installed a bunch of packages with pip. I've now written code using these packages.
I have a myscript.py
My friend is on windows.
has python installed.
He has no packages.
He cannot get any packages.
He has pip
He will never be able to use the internet to get more packages everything must be hand delivered.
In fact about 10 minutes after he runs whatever I give him, he formats his machine and it's gone.
How do I take myscript.py and give it to him on a USB stick so that he can copy the file myscript.py onto his computer and run it?
I thought Pipenv would do it but it looks like it just creates a LIST of packages to download from the internet. (a very well defined list... but a list not the actual files needed to run something. Do I understand it correctly?
Right now I'm giving him .exe made with py2exe. This isn't very elegant considering he has python already.
tl;dr how do I give a python script .py to an end user that doesn't have the internet?
You can package everything up in a virtual environment and give him the complete environment necessary to run the script. You can read about this at https://developer.mozilla.org/en-US/docs/Python/Virtualenv and an IDE like PyCharm will help you create such an environment easily.
It's actually a good thing to learn about and do anyway.

Issue with Python on Windows 10

Specifically on my shiny new Surface Pro 2017 (i5, 256GB, 8GB RAM). So I'm trying to set up my dev environment and I'm running into a bit of a snag.
It shows up as installed through Powershell -and I'm able to run Python fine through it- but when I try the same on my Bash and Hyper terminals, no luck. I'm realizing now that Bash is not pictured in the screenshot, but it says the same thing when I try to run python commands. Did my due diligence in searching through the Surface subreddit, Google, and of course, Stack.
Anyone know what could be the issue?
Screenshot
In my opinion the best solution is to install python inside your bash environment, too. What is the main reason you even want to call the Windows version of python from the bash? If installing python inside the Ubuntu subsystem/the bash again, then you might try to find out the path to the python.exe inside your Windows installation and try to add these path to your bash's path, too.
Do yourself a huge favor and install Anaconda, and use command line prompt from now on and don't even Touch Powershell or bash. It's windows not linux. The reason I say anaconda is because it gives you a huge array of libraries and also you can create a virtual environment meaning if Python gets screwed on or corrupted at least your file paths will be okay.

Simplest way for end users to run Python script on network drive without installation?

I want to start using Python at work, and I have a script that I need all the end users to run on a central network drive.
However, they don't have admin rights to install Python and I am not going to call desktop support and go through that mess. I'm thinking of putting my WinPython installation on the network, pointing to the py.exe in a BAT file, and instruct users to run the BAT file.
Is there a better way to do this?
I ended up using WinPython and that suited my needs nicely. It's a convenient little package.
http://winpython.sourceforge.net/
Have you tried using py2exe or Pyinstaller? Pyinstaller converts python scripts to standalone executables that can be run on windows, linux, and Mac OS.
Here's the link to their wiki page on github: https://github.com/pyinstaller/pyinstaller/wiki

Need to run python script in an environment where python is not present

I need to run python in an environment where there wont be python. Is it possible to execute python as an executable in Unix Environments, like HP-UX, IBM-AIX, Solaris, Linux etc etc....
The targeted OS is AIX now.... since it does not have python support and the installation is difficult......
Thanks.
I have used http://www.pyinstaller.org/ to create an executable in ubuntu. look at their manual, it also have the cool feature of outputting just one file with --onefile. My first choice was freeze but the executable failed to run when I used some external modules - I could not solve it and I found pyinstaller to be perfect for me.

Categories