[Solution] Point octave to anaconda python (Mac)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Solution] Point octave to anaconda python (Mac)

SolarPython
Hello @all,

I was looking for the possibility to point octave to the python installed by
anaconda on a Mac. I want to share with you the solution I've found.

I already found two posts about this:

http://octave.1599824.n4.nabble.com/Installing-the-symbolic-package-td4672222.html
http://octave.1599824.n4.nabble.com/Getting-Octave-to-use-Anaconda-Python-Environment-td4676345.html

The approach mentioned in the second one (installing sympy to the
system-python) did not work for me.

In the end I found the right command/path to the anaconda python.

Type in octave:

/setenv PYTHON /anaconda3/bin/python//
/sympref reset /
/sympref diagnose /

and it should work :)



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

CdeMills
Hello,

maybe it's a dumb answer, but what about virtual environments ?

from the command line:
    conda create -n yourenvname python=x.x anaconda
    source activate yourenvname
   octave

Pascal



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

Colin Macdonald-2
In reply to this post by SolarPython
On 2018-08-20 04:39 AM, SolarPython wrote:
> In the end I found the right command/path to the anaconda python.

Excellent, that is how it is supposed to be done.  I edited your
commands below because there were some extra slashes around.

It might be helpful for others if you could document this at:

https://github.com/cbm755/octsympy/wiki/Notes-on-macOS-installation

> Type in octave:
>
> setenv PYTHON /anaconda3/bin/python
> sympref reset
> sympref diagnose
>
> and it should work :)


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

Colin Macdonald-2
In reply to this post by CdeMills
On 2018-08-20 08:14 AM, CdeMills wrote:

> Hello,
>
> maybe it's a dumb answer, but what about virtual environments ?
>
> from the command line:
>      conda create -n yourenvname python=x.x anaconda
>      source activate yourenvname
>     octave
>
> Pascal

Seems like that should work.  Provided the virtual environment sets
"$PYTHON", the Symbolic package should pick up on it.

I use neither Mac nor Conda: what does one type to install sympy within
"yourenvname"?

It would be *great* if someone can test all this and document it here:

https://github.com/cbm755/octsympy/wiki/Notes-on-macOS-installation

thanks,
Colin


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

CdeMills
Colin Macdonald-2 wrote

> On 2018-08-20 08:14 AM, CdeMills wrote:
>> Hello,
>>
>> maybe it's a dumb answer, but what about virtual environments ?
>>
>> from the command line:
>>      conda create -n yourenvname python=x.x anaconda
>>      source activate yourenvname
>>     octave
>>
>> Pascal
>
> Seems like that should work.  Provided the virtual environment sets
> "$PYTHON", the Symbolic package should pick up on it.
>
> I use neither Mac nor Conda: what does one type to install sympy within
> "yourenvname"?
>
> It would be *great* if someone can test all this and document it here:
>
> https://github.com/cbm755/octsympy/wiki/Notes-on-macOS-installation

Well, I don't have a Mac at hand. Nevertheless, this is just standard
Python:

      conda create -n yourenvname python=x.x anaconda
      source activate yourenvname
      pip install sympy # this will use the right Python version, paths and
so on
     octave

Pascal



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

CdeMills
In reply to this post by Colin Macdonald-2
Colin Macdonald-2 wrote

> On 2018-08-20 08:14 AM, CdeMills wrote:
>> Hello,
>>
>> maybe it's a dumb answer, but what about virtual environments ?
>>
>> from the command line:
>>      conda create -n yourenvname python=x.x anaconda
>>      source activate yourenvname
>>     octave
>>
>> Pascal
>
> Seems like that should work.  Provided the virtual environment sets
> "$PYTHON", the Symbolic package should pick up on it.
>
> I use neither Mac nor Conda: what does one type to install sympy within
> "yourenvname"?
>
> It would be *great* if someone can test all this and document it here:
>
> https://github.com/cbm755/octsympy/wiki/Notes-on-macOS-installation

Well, for Anaconda, things are detailed here:
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

So it would go as follows:

    conda create -n yourenvname python=x.x anaconda
    source activate yourenvname
    conda install -n yourenvname sympy
   octave

Regards

Pascal



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: [Solution] Point octave to anaconda python (Mac)

Colin Macdonald-2
On 2018-08-20 02:06 PM, CdeMills wrote:

>> It would be *great* if someone can test all this and document it here:
>>
>> https://github.com/cbm755/octsympy/wiki/Notes-on-macOS-installation
>
> Well, for Anaconda, things are detailed here:
> https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
>
> So it would go as follows:
>
>      conda create -n yourenvname python=x.x anaconda
>      source activate yourenvname
>      conda install -n yourenvname sympy
>     octave
>
> Regards

So which is "better"?  Get the conda thing to pull in sympy?  Or use pip
within the conda environment?

In the conda version do you really have to activate *before* doing
`conda install -n yourenvname sympy`?

I would've thought these instructions look like this:

- - - - - - - - - - -

Does this one time
==================

get "conda"
conda create -n yourenvname python=x.x anaconda  [?? link to above
article for what to use for x.x]
conda install -n yourenvname sympy


Every time you want to run Octave
=================================

source activate yourenvname   [?? does it matter what directory I'm in?]
octave
pkg load symbolic
syms x