How do I get PhantomJS / CasperJS working on Cygwin? - cygwin

I am having trouble getting PhantomJS and CasperJS working within the cygwin environment. I am very new to cygwin. I was able to download both packages for windows and run them via windows cmd.
To get them to work with Cygwin, I tried the following:
I downloaded the tar/zip files for both PhantomJS and CasperJS, I copied the contents on the "bin" folders into C:\cygwin\bin. But when I type in phantomjs on cygwin I get:
/usr/bin/phantomjs: cannot execute binary file
Then, I tried to do:
pip install git+git://github.com/ariya/phantomjs
but after waiting for a while I get the following response:
Downloading/unpacking git+git://github.com/ariya/phantomjs Cloning
git://github.com/ariya/phantomjs to /tmp/pip-dCF1oZ-build Running
setup.py egg_info for package from
git+git://github.com/ariya/phantomjs
Traceback (most recent call last):
File "", line 16, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-dCF1oZ-build/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 16, in
IOError: [Errno 2] No such file or directory:
'/tmp/pip-dCF1oZ-build/setup.py'
---------------------------------------- Command python setup.py egg_info failed with error code 1 in /tmp/pip-dCF1oZ-build Storing
complete log in /home/tkondapalli/.pip/pip.log
Does any one have any advice on how to get this working? Does anyone use PhantomJS/CasperJS in the cygwin environment?
Also, I thought the .exe I am downloading and copying into the C:\cygwin\bin directory is the one for linux, so maybe that doesn't work? So this means that I need to compile from source on cygwin...
So, I started following directions for building phantomjs: http://phantomjs.org/build.html
The first thing we need to do is build OpenSSL for devel, but again I don't know how to do this for cygwin! So I just skipped this step for now, which is probably not right.
I did download the source from github and tried to build it. It failed with the follow error:
Makefile:217: recipe for target `qtemporaryfile.o' failed make: *
[qtemporaryfile.o] Error 1 make: * Waiting for unfinished jobs....
make: *** No targets specified and no makefile found. Stop.
./build.sh: line 90: src/qt/bin/qmake: No such file or directory
Earlier I had downloaded the executables for Linux, so it was not working. This time I downloaded the executables for windows and put it in C:/cygwin/bin, and it worked!
I don't understand why I would need to download the windows executable, when cygwin is a linux emulator. This confuses me, but at least it works now!

From the Cygwin website:
Cygwin is not: a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
Every applications needs to be rebuilt in order to be use on Windows (as it does not produce an elf file, but .exe file that requires the cygwin dll).
Nevertheless, the shell in cygwin can execute any windows's .exe file (such as ping, ipconfig, cmd, etc.), which is why you are able to run the windows version of PhantomJS under cygwin.

First, download and install Node.js from http://nodejs.org/download
Close and reopen Cygwin and type:
$ npm install -g phantomjs
$ npm install -g casperjs

Just ran into this issue, placing the phantomjs executable in C:/cygwin/bin solved everything. After that all you need to do is run the command C:/cygwin/bin/phantomjs to initialize the application.
Although Cygwin doesn't replace the standard cmd prompt, it is pretty useful!

Related

Can Execute Commands in Terminal But Not from Text File

I'm running code using Ubuntu on a WSL. Every time I edit some C files I need to execute a makefile and run an installer to ensure that the changes are reflected in the python package that I am using. The set of commands I need to execute is
make clean
make
cd python
python setup.py install --user
This works perfectly when I execute them in the terminal. In order to make my life easier, I decided to put these commands in a text file Compile.txt to be executed whenever I need to compile the relevant files. I found this question and tried to replicate its solution. However, whenever I type ./Compile.txt into the terminal I get the error
'. Stop. No rule to make target 'clean
gcc -o .o
gcc: fatal error: no input files
compilation terminated.
make: *** [<builtin>: .o] Error 1
./Compile.txt: line 7: cd: $'python\r': No such file or directory
python: can't open file 'setup.py': [Errno 2] No such file or directory
Can anyone explain what I've done wrong? I apologise for any misuse of terminology as I'm still quite new to Linux.
Thanks in advance.

pycharm and pyinstaller confusion

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?

How to install miniupnpc as a python module on windows

I want to use UPnP in my python scripts, so I tried to install miniupnpc through pip install miniupnpc. But It causes an error a little bit after the installation starts:
ERROR: Command errored out with exit status 1:
cwd: C:\Users\sammy\AppData\Local\Temp\pip-install-jrjs0fss\miniupnpc\
Complete output (4 lines):
running install
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
I checked the GitHub but I don't know where to find the tools I need to compile the python module or how to use them.
I believe at the time the library was a little bit bugged, I never worked out the issue in the end, I recommend looking for other tools.
It is also worth mentioning I wasn't a very good programmer back then, I now actually understand the nature of libraries and packages.

Installing Linux Library on Windows Using Mingw

I am attempting to install GTKExtra on windows. The package comes in a Tar.Gz and contains a Configure file. So its necessary to install the package using MinGw because the package is designed to be installed on Linux.
I have installed MinGW and MSYS. I have made sure that C:\MinGW\msys\1.0\etc\fstab contains the line C:\MinGW /mingw (plus an empty line below it).
My Problem: I still cant get windows run the Configure file. When I type in ./Configure into CMD I get the error '.' is not recognized as an internal or external command, operable program or batch file.
The steps I am taking are:
Open cmd.exe
Navigate to the folder that contains the configure file using cd C:/...
Type in ./configure (as per the instructions found in INSTALL. But this causes the error I described above
How can I run the configure file on windows? What have I done wrong?
You have to run the command in unix command prompt. For starting unix command prompt execute "msys.bat" in msys installation.

How do use a command where you changed its installation directory in linux?

Hello I am on a linux server running 2.6.18-274.e15. I have installed a program called scons in order to compile a program called rosetta. In order to get scons to install when I ran it's python install I used the following command
python setup.py install flexed --prefix=.
This was because I am unable to use the folder it was trying to download into with my user status. When I call "scons --version" I am getting "command not found".
What I am wondering:
Is running scons even possible with my setup?
If so, what command would I use?
Thanks!
you need to add the directory of your binary to your path, in the shell:
$ export PATH=$PATH:/the/dir/of/your/binary

Resources