Quantcast

Getting Octave to use Anaconda Python Environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Getting Octave to use Anaconda Python Environment

OrbitalMechanic
I'm running Octave version 4.0.0 on a MacBook Pro running Mac OS X ver.
10.11.4 (El Capitan). How does one get the Octave application to use the
Anaconda Python Environment?

Sam Dupree.



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

bpabbott
Administrator
> On Apr 17, 2016, at 21:38, Samuel Dupree <[hidden email]> wrote:
>
> I'm running Octave version 4.0.0 on a MacBook Pro running Mac OS X ver. 10.11.4 (El Capitan). How does one get the Octave application to use the Anaconda Python Environment?
>
> Sam Dupree.

I don't know if I understand your question, but Octave's symbolic toolbox uses sympy. Perhaps looking at the code would help.

Ben
_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

OrbitalMechanic
Ben,

You are correct when you say that Octave's symbolic toolbox uses sympy.
However, the version of sympy I'm using is installed in the Anaconda
environment, so my question is how do I get Octave to recognize it
should be looking to /Users/user/anaconda for python.

How do I get Octave to use python at /Users/user/anaconda?

Sam Dupree.



On 4/17/16 22:06:52, Ben Abbott wrote:

>> On Apr 17, 2016, at 21:38, Samuel Dupree <[hidden email]> wrote:
>>
>> I'm running Octave version 4.0.0 on a MacBook Pro running Mac OS X ver. 10.11.4 (El Capitan). How does one get the Octave application to use the Anaconda Python Environment?
>>
>> Sam Dupree.
> I don't know if I understand your question, but Octave's symbolic toolbox uses sympy. Perhaps looking at the code would help.
>
> Ben
>
>


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

bpabbott
Administrator
On Apr 17, 2016, at 11:04 PM, Samuel Dupree <[hidden email]> wrote:

On 4/17/16 22:06:52, Ben Abbott wrote:

On Apr 17, 2016, at 21:38, Samuel Dupree <[hidden email]> wrote:

I'm running Octave version 4.0.0 on a MacBook Pro running Mac OS X ver. 10.11.4 (El Capitan). How does one get the Octave application to use the Anaconda Python Environment?

Sam Dupree.

I don't know if I understand your question, but Octave's symbolic toolbox uses sympy. Perhaps looking at the code would help.

Ben

Ben,

You are correct when you say that Octave's symbolic toolbox uses sympy. However, the version of sympy I'm using is installed in the Anaconda environment, so my question is how do I get Octave to recognize it should be looking to /Users/user/anaconda for python.

How do I get Octave to use python at /Users/user/anaconda?

Sam Dupree.

Octave’s symbolic toolbox is tricky to install on OS X. I’m confident it can be done, but haven’t yet done it myself. My difficulty is due to Fink’s python which is named “python2.7”. In order for symbolic-2.3.0 toolbox’s configure process to use Fink’s python2.7, it is necessary to modify configure.ac …

16 
-17 AC_PATH_PROG(PYTHON, python)
+17 AC_PATH_PROG(PYTHON, python2.7)
18 if test -z "$PYTHON"; then
19   AC_MSG_ERROR(Failed to find Python)
20 fi

You’ll need to replace “python2.7” with the command needed to run python in the Anaconda environment.

Next, run ./bootstrap in order to create the configure script that uses the desired python command.

Then create a tarball for symbolic-2.3.0 using the corrected configure script.

   tar -z -c -f symbolic-2.3.0.tar.gz symbolic-2.3.0

The symbolic toolbox requires sympy >=0.7.5. Fink provides version 0.7.3. Thus, I created a local Fink package for version 0.7.6.1 and installed it. 

I then installed a local version of the Symbolic toolbox

   pkg install -local symbolic-2.3.0.tar.gz

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

Colin Macdonald-2
On 18/04/16 09:21, Ben Abbott wrote:
> Octave’s symbolic toolbox is tricky to install on OS X. I’m confident it
> can be done, but haven’t yet done it myself. My difficulty is due to
> Fink’s python which is named “python2.7”. In order for symbolic-2.3.0
> toolbox’s configure process to use Fink’s python2.7, it is necessary to
> modify configure.ac …

I filed:

https://github.com/cbm755/octsympy/issues/412

I'm considering dumping all the autoconf stuff from Symbolic: we have
nothing to compile, all its used for is checking that Python and SymPy
are installed.  And it just seems to get in the way on Windows and
(apparently now) MacOS.

Colin



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

bpabbott
Administrator
> On Apr 18, 2016, at 4:52 PM, Colin Macdonald <[hidden email]> wrote:
>
> On 18/04/16 09:21, Ben Abbott wrote:
>> Octave’s symbolic toolbox is tricky to install on OS X. I’m confident it
>> can be done, but haven’t yet done it myself. My difficulty is due to
>> Fink’s python which is named “python2.7”. In order for symbolic-2.3.0
>> toolbox’s configure process to use Fink’s python2.7, it is necessary to
>> modify configure.ac …
>
> I filed:
>
> https://github.com/cbm755/octsympy/issues/412
>
> I'm considering dumping all the autoconf stuff from Symbolic: we have
> nothing to compile, all its used for is checking that Python and SymPy
> are installed.  And it just seems to get in the way on Windows and
> (apparently now) MacOS.
>
> Colin

I like the autoconf support. They allowed me to determine what depedencies were missing. The only problem for me was how to define $PYTHON. Can you modify configure to grab $PYTHON from the shell environment?

        setenv PYTON python2.7
        system ./configure

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

Colin Macdonald-2
On 18/04/16 17:00, Ben Abbott wrote:
> I like the autoconf support. They allowed me to determine what
> depedencies were missing. The only problem for me was how to define
> $PYTHON. Can you modify configure to grab $PYTHON from the shell
> environment?
>
> setenv PYTON python2.7
> system ./configure

This sounds like a good idea.  At run-time, we would need to support
that variable too, which could be useful.

*But* is $PYTHON env variable a standard thing?!

I didn't see it here:
https://docs.python.org/2/using/windows.html

Do you have a reference?

thanks,
Colin

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

Colin Macdonald-2
On 18/04/16 20:18, Colin Macdonald wrote:
> *But* is $PYTHON env variable a standard thing?!

Maybe see the discussion here instead:

https://github.com/cbm755/octsympy/issues/412



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

bpabbott
Administrator
In reply to this post by Colin Macdonald-2
> On Apr 18, 2016, at 11:18 PM, Colin Macdonald <[hidden email]> wrote:
>
> On 18/04/16 17:00, Ben Abbott wrote:
>> I like the autoconf support. They allowed me to determine what
>> depedencies were missing. The only problem for me was how to define
>> $PYTHON. Can you modify configure to grab $PYTHON from the shell
>> environment?
>>
>> setenv PYTON python2.7
>> system ./configure
>
> This sounds like a good idea.  At run-time, we would need to support
> that variable too, which could be useful.
>
> *But* is $PYTHON env variable a standard thing?!
>
> I didn't see it here:
> https://docs.python.org/2/using/windows.html
>
> Do you have a reference?

Do standards apply? I expect all you need is for “./configure —help” to document what environment variables are supported.

Ben
_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

Mike Miller-4
On Tue, Apr 19, 2016 at 07:28:47 -0400, Ben Abbott wrote:

> > On Apr 18, 2016, at 11:18 PM, Colin Macdonald <[hidden email]> wrote:
> >
> > On 18/04/16 17:00, Ben Abbott wrote:
> >> I like the autoconf support. They allowed me to determine what
> >> depedencies were missing. The only problem for me was how to define
> >> $PYTHON. Can you modify configure to grab $PYTHON from the shell
> >> environment?
> >>
> >> setenv PYTON python2.7
> >> system ./configure
> >
> > This sounds like a good idea.  At run-time, we would need to support
> > that variable too, which could be useful.
> >
> > *But* is $PYTHON env variable a standard thing?!
> >
> > I didn't see it here:
> > https://docs.python.org/2/using/windows.html
> >
> > Do you have a reference?
>
> Do standards apply? I expect all you need is for “./configure —help” to document what environment variables are supported.

No they don't. I think it would be useful to support a PYTHON
environment variable, which could either be the name of the executable
to search for on PATH (e.g. python3) or the full path to the Python
executable to use.

This could be useful for either configure, if kept, or at runtime, with
an error message instructing the user to "setenv PYTHON ..." and rerun
the command.

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting Octave to use Anaconda Python Environment

cranexcrane
In reply to this post by OrbitalMechanic
Sam --
This is late reply, but I had exactly the same problem that you had, with Octave refusing to "see" the packages that I had installed under Anaconda.

Ultimately, I was able to resolve the issue by directly installing the latest version of sympy to my system's non-Anaconda Python directories.

This involved:

    1. navigating to sympy.org and downloading the tarball for the latest release:
        https://github.com/sympy/sympy/releases/download/sympy-1.0/sympy-1.0.tar.gz

    2. in terminal, navigating to my downloads folder and unpacking the tarball:
        cd ~/Downloads/
        tar -xvzf sympy-1.0.tar.gz

    3. navigating to the extracted folder and running the setup file:
        cd sympy-1.0
        sudo python setup.py install

.. and that's it!

The readme file included in the tarball was quite helpful.

It mentions that sympy has a hard dependency on the mpmath library, which fortunately was already up-to-date on my system.

Anyhow, this doesn't actually answer the question of how to reconfigure Octave to utilize Python packages installed under Anaconda, but it does resolve the larger issue we were both having.

Best,
Crane
Loading...