To run mining_pandas.IPYNB locally - docplex

I'm using Cplex Studio Community 12.8 on Windows 64.
I've installed docplex using conda install -c ibmdecisionoptimization docplex.
To solve mining_pandas.IPYNB, the current command is:
s1 = mm.solve(url=url, key=key, log_output=print_cplex_log)
How can I run it locally?

I've set the environment variable PYTHONPATH to yourCPLEXhome/python/VERSION/PLATFORM.

Related

Unable to install nextflow correctly

I've attempted to install Nextflow with command "curl get.nextflow.io | bash" in my Windows system command prompt-bash, but I consistently see this error: Unable to initialize nextflow environment
In parallel, on a remote server, the Nextflow is installed with the same command and I can verify that with ls command. However, when I prepare a sample script (hello.nf), executing it by "nextflow run hello.nf" shows that Nextflow is not characterised.
In any of cases, typing "nextflow info" doesn't recognise nextflow. Is there anyway that I can install Nextflow or have I missed any step? I have also tried with wget, but no success yet.
Thanks in advance!
If you have Windows 10 Version 1903 with Build 18362 or higher, you can use the Windows Subsystem for Linux 2 (WSL 2) rather than having to configure a Linux VM. There's a few hoops to jump through, but this guide (Oct 2021) should be sufficient: Setting up a Nextflow environment on Windows 10
On your remote machine, all you should need to do is to move your nextflow to somewhere in your $PATH. Alternatively, you can just call it with ./nextflow (assuming it is in your current directory).

I failed to convert caffe model into mlmodel using coremltools 5

I try to convert caffe model. I am using coremltools v5.
this is my code
import coremltools
caffe_model = ('oxford102.caffemodel', 'deploy.prototxt')
labels = 'flower-labels.txt'
coreml_model = coremltools.converters.caffe.convert(
caffe_model,
class_labels=labels,
image_input_names='data'
)
coreml_model.save('FlowerClassifier.mlmodel')
I convert using below command
python3 convert-script.py
And i get an error message like below.
error message
Does anybody face this problem and have solution on it?
I just came across this as I was having the same problem. The caffe support is not available in the newer versions of coremltools API. To make this code run an older version of coremltools (such as 3.4) must be used, which requires using Python 2.7 - which is best done in a virtual environment.
I assume you've solved your issue already, but I added this in case anyone else stumbles onto this question.
There are several solutions according to your case:
I had the same issue on my M1 Mac. You can resolve the same by duplicating your Terminal, and running it with Rosetta.(This worked for me)
cd ~/.virtualenvs/<your venv name here>/bin
mkdir bk; cp python bk; mv -f bk/python .;rmdir bk
codesign -s - --preserve-metadata=identifier,entitlements,flags,runtime -f python
Fore more solutions and issue you can watch this issue on github
I had the same error running python 3.7
In the virtualenv, solution is to run:
pip install coremltools==3.0
Don't have to change python versions and just rerun the script

Python tests discovery fails with remote.ssh + conda env

I'm using vcsode on windows with Remote SSH to develop python code hosted on linux.
My python environment is a conda env based on python3.7.
During the test discovery stage, the run_adapter.py script is launched and fails with the following log:
python /home/scharlois/.vscode-server/extensions/ms-python.python-2020.2.64397/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /path/to/my/project -s --cache-clear tests
Test Discovery failed:
Error: ERROR 1: PROJ: proj_create_from_database: Open of /home/scharlois/.conda/envs/conda37/share/proj failed
I have no error when I execute the same command in the conda env. on the remote host
Which interpreter is used to run the run_adapter.py script? Is the conda python one ?
It is the python conda interpreter. (displayed modifying the run_adapter script)
I found a workaround: inserting in the script the folowing lines before the main execution:
import os
os.environ["PROJ_LIB"]=""

How to set up Spark to use pandas managed by anaconda?

We've updated the Spark version from 2.2 to 2.3, but admins didn't update the pandas. So our jobs fail with the following error:
ImportError: Pandas >= 0.19.2 must be installed; however, your version was 0.18.1
Our admin team suggested to created a VM downloading latest version from anaconda (using the command conda create -n myenv anaconda).
I did that and after activating the local environment using source activate myenv when I logged into pyspark2 then I found it was picking the new version of pandas.
But when I am submitting a job using spark2-submit command then it is not working. I did added the below configuration in the spark2-submit command
--conf spark.pyspark.virtualenv.enabled=true
--conf spark.pyspark.virtualenv.type=conda
--conf spark.pyspark.virtualenv.requirements=/home/<user>/.conda/requirements_conda.txt --conf spark.pyspark.virtualenv.bin.path=/home/<user>/.conda/envs/myenv/bin
Also I did zipped whole python 2.7 folder and passed that in the --py-files option along with other .py files --py-files /home/<user>/python.zip, but still getting the same version issue for pandas.
I tried to follow the instruction specified in the URL https://community.hortonworks.com/articles/104947/using-virtualenv-with-pyspark.html , but still no luck yet.
How to fix it and be able to spark2-submit with the proper pandas?
I think you may need to define environment variables such as SPARK_HOME and PYTHONPAH pointing to corresponding locations in your virtualenv.
export SPARK_HOME=path_to_spark_in_virtualenv
export PYTHONPATH=$SPARK_HOME/python

Installing Solaris Studio 12.2 in Ubuntu

I need help with installing Solaris Studio 12.2 on Ubuntu.
I looked at this question already and it didn't help: Installing Solaris Studio 12.2?
My problem with the solutions provided in that question is that I do not have a script to run when I extract the file I downloaded: SolarisStudio12.2-linux-x86-tar-ML.tar.bz2
To extract it I am just using the Ubuntu GUI, archive manager.
Could this be my problem?
Also I already posted this on askUbuntu: Got no response.
There is no installation script to run with the tarfile distribution. You just extract the archive somewhere and that's it, Solaris Studio is installed and ready to use. You just need to add its bin directory to your PATH.
I'm not familiar with Ubuntu GUI archive manager so here is how I proceed:
$ bunzip2 < SolarisStudio12.2-linux-x86-tar-ML.tar.bz2 | tar xf -
$ PATH=$PWD/SolarisStudio12.2-linux-x86-tar-ML/solstudio12.2/bin cc -V
cc: Sun C 5.11 Linux_i386 2010/08/13
usage: cc [ options ] files. Use 'cc -flags' for details