Setting up CPLEX with Python on Mac - python

I'm trying to install cplex on Python on my Mac but I'm really stuck.
The setup.py file is in the following path:
/Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex/python/2.7/x86-64_osx
I am using canopy for running Python.
I entered the following code in Terminal of Mac and the result was as follows:
macs-mbp:~ mac$ python setup.py install
/Users/mac/Library/Enthought/Canopy_64bit/User/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
macs-mbp:~ mac$
I then decided to use (option --home) but the result was also terrible:
macs-mbp:~ mac$ python setup.py install --home /Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex
/Users/mac/Library/Enthought/Canopy_64bit/User/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
macs-mbp:~ mac$
I tried using cd too but that didn't yield an improvement.
Any help would be appreciated for installing cplex on Python on Mac!

This looks like it might be similar to this SO question.
What happens if you do the following:
cd /Users/mac/Applications/IBM/ILOG/CPLEX_Studio127/cplex/python/2.7/x86-64_osx
python setup.py install
Also, you have to make sure that the "python" above points to the python you want (canopy vs the system python).

Related

#[Errno 2] No such file or directory

So, here what I am doing
from the below link:
https://django-microsoft-auth.readthedocs.io/en/latest/installation.html#from-sources
I am trying to follow all the steps mention in the blog for the installation of django_microsoft_auth.
Step-1 i.e. "pip install django_microsoft_auth" # is working
Step-2 i.e. "git clone git://github.com/AngellusMortis/django_microsoft_auth" # is also working
Step-3 i.e. "python setup.py install" # is giving me the below error.
C:\Users\vtinkhed\AppData\Local\Programs\Python\Python37\python.exe:
can't open file 'setup.py': [Errno 2] No such file or directory
I don't know how to help. Could anybody help me out here?
Thanks in advance
You need to start setup.py from the folder where it is located.
Use cd to get to that folder, then run python setup.py install
I had the same Issue. My problem was that my script had a space in in. ' hello.py' instead of 'hello.py'. After renaming it worked well.

Install SCIP solver on Python3.5 Numberjack (OSX)

I am learning Constraint Programming in Python and, for the solving of the problems, I am supposed to use the SCIP solver. I have installed the Numberjack standard package from Github witch includes Mistral, Mistral2, Toulbar2, MipWrapper, SatWrapper, MiniSat and Walksat solvers.
Running my code I got the following error:
Traceback (most recent call last):
File "/Users/angelocoelho/anaconda3/lib/python3.5/site-packages/Numberjack/__init__.py", line 910, in load
lib = __import__(solverstring, fromlist=[solverspkg])
ImportError: No module named 'Numberjack.solvers.SCIP'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "grafosdefluxos.py", line 42, in <module>
solver = model.load('SCIP')
File "/Users/angelocoelho/anaconda3/lib/python3.5/site-packages/Numberjack/__init__.py", line 915, in load
solvername)
ImportError: ERROR: Failed during import, wrong module name? (SCIP)
I already ran make in 'scipoptsuite-3.1.0' and in 'scip-3.2.1', installed Numberjack-master's 'setup.py' and tried this:
python setup.py -solver SCIP
witch returned the error
Error: the solver 'SCIP' is not known, please use one of: Mistral, SatWrapper, Toulbar2, Walksat, MipWrapper, MiniSat, Mistral2
I have the SCIP folders alongside and inside the Numberjack folders.
I read and ran all the commands in the README and INSTALL files on how I could get this solver configured but I couldn't get it right.
How can I get SCIP available to solve the problems in Numberjack?
After talking to the assistant teacher I got the answer for this problem.
The folder where Numberjack/SCIP was being installed was not the one it was supposed to be, therefore it was not really included in the solver list. After completing the python setup.py build and python setup.py install installation I ran python setup.py build -solver SCIP and the terminal feedback stated
Successfully built solver interfaces for MipWrapper, SCIP
But the jupyter notebook didn't recognize the solver.
What solution should work having Anaconda (python3.5) already installed:
Download Numberjack (file "Numberjack-master.zip") and unpack it.
Download SCIP and copy the downloaded file, scipoptsuite-3.1.0.tgz. Paste it inside Numberjack-master unpacked directory. The path of it should be ~/Downloads/Numberjack-master/scipoptsuite-3.1.0.tgz.
In terminal run cd ~/Downloads/Numberjack-master (or your Numberjack-master directory path).
Then run python3.5 setup.py install --user.
In my case Jupyter was looking for the solvers in
~/anaconda3/lib/python3.5/site-packages/Numberjack/ and they were
not being installed there so, instead of using python, I used python3.5 since my Anaconda was the Python 3.5 package.
Why is there a scip-3.2.1 directory? The SCIP Opt Suite 3.1.0 contains SCIP 3.1.0. You need to make sure to run all setup and make commands exactly as stated on the Numberjack install page.

python: can't open an existing file even if the path has already been clearly added

I am using python 2.7.11 and I have downloaded setuptools-2.2 for its included setup.py file. Then I did a python setup.py install (This command is successful), and I added the path for this setup.py file to ~/.bash_profile.
export PATH=/opt/python2711/lib/python2.7/site-packages/:$PATH
export PATH=/path-to-setuptools/setuptools-2.2/:$PATH
However, when I tried to install another software (./pybombs install uhd), my computer kept complaining:
Build failed. Re-trying with reduced makewidth and higher verbosity.
python: can't open file 'setup.py': [Errno 2] No such file or directory
I actually tried to add the path of that egg file as well, but it couldn't help either. I don't know much about this setup.py file. Could somebody point out how to fix this compiling error?
Thanks in advance!
add your path in ~/.profile
export PATH=$PATH:/path/to/dir
~/.profile: executed by the command interpreter for login shells.
how ever the path variable is in
/etc/environment : file open and add the path here you should log in as root

"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.

Importing modules with python

I'm working with python 2.7 (32-bit) on Windows Vista. I downloaded some libraries including numpy, scipy, and pygame. When I try to import these modules the output says
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
ImportError: No module named numpy
I can find these modules in my python folders but for some reason it doesn't want to recognize it or some thing. (I made sure the file were compatible before downloading.)
Each package should contain a setup.py file. Run this with the command python setup.py install
For more information:
http://www.scipy.org/Installing_SciPy/Windows
http://pygame.org/install.html
"Everytime I run the command "python setup.py install" in the python shell it says SyntaxError: invalid syntax "
Please create a folder where you unzip the "numpy.zip" file, say the folder name is "c:\numpy"
Open a MS-DOS terminal (as described here : http://en.wikipedia.org/wiki/Command-line_interface), and type :
cd c:\numpy
python setup.py config
python setup.py install
This will set up the needed files in the correct folders for your python.
Enjoy !
To properly install this module:
In the Windows search bar (START MENU) type Command Prompt
Right-click on the Command Prompt icon (DO NOT go to cmd)
Click Run as Administrator
in the COMMAND PROMPT (DO NOT open cmd) type:
pip install numpy
This will install that module.
NOTE: If you are NOT in admin mode, you will get a message saying a fatal error has been raised.

Categories

Resources