Giter Site home page Giter Site logo

Freature request: pip package about auto-07p HOT 10 OPEN

auto-07p avatar auto-07p commented on June 13, 2024 2
Freature request: pip package

from auto-07p.

Comments (10)

Debilski avatar Debilski commented on June 13, 2024

Looking at it, this might require that the python code becomes a proper module (ie. with an __init__.py file) as opposed to having everything at the top level of Python hierarchy, which probably means changing the import structure internally and externally (may be for the better tbh). Am I analysing this correctly?

from auto-07p.

bartoldeman avatar bartoldeman commented on June 13, 2024

I was thinking the same thing: it would be great to be able to do pip install auto, but it does inded involve a fair amount of work. At the moment the closest there is to it are the *.xauto files, which all have from auto import * (historical.. I know this is not recommended, but easy to adjust); the autox script does very little, just adjust PYTHONPATH and run python with the script.

from auto-07p.

Debilski avatar Debilski commented on June 13, 2024

Hi, I’ve made some quick changes to the import structure and added a setup.py/setup.cfg definition for installation. master...Debilski:python-module
I have not at all thoroughly tested it though (we’ll test it in the lab and probably add some more changes) but it could be used as a starting point.

from auto-07p.

bartoldeman avatar bartoldeman commented on June 13, 2024

Thanks @Debilski : I merged your changes but changed all relative imports from . import xxx to absolute imports from auto import xxx. This helps with some of the existing scripts and doing imports inside the AUTO clui.

of course this setup.py is only a start, since it doesn't take care of the Fortran files yet.

from auto-07p.

Debilski avatar Debilski commented on June 13, 2024

Thanks for merging, @bartoldeman. For us, this solves already many problems, since we can now install the Python package in its own virtual environment. Having the Fortran part separate in its AUTO_DIR is not so much of a problem in comparison to having to change sys.path.

from auto-07p.

symbiosdotwiki avatar symbiosdotwiki commented on June 13, 2024

How does one install this package with pip or conda currently? I've tried appendind sys path but I still cannot import the module

from auto-07p.

Debilski avatar Debilski commented on June 13, 2024

@nwaxiomatic I don’t know if this is the officially approved way of doing things, but at my institute we are currently doing it as follows:

# Install the Python module with pip,
# which means no messing around with sys.path is needed (thankfully!)
# (if this is no conda/Python environment,
# then adding the --user flag might be sensible)
pip install git+https://github.com/auto-07p/auto-07p

# now, Python will find the module, but won’t properly import it,
# because it cannot find the cmd scripts (and none of the Fortran files etc.)
# Those need to be compiled separately and the AUTO_DIR environment variable
# needs to be set so that the Python module can find it.
git clone https://github.com/auto-07p/auto-07p
cd auto-07p
./configure && make

# Not sure if a `make install` is strictly needed; it might work without,
# if you only want to use it from Python.
# Finally, set the environment variable to the directory we cloned the auto repo to.
export AUTO_DIR=$(pwd)

# Now it should be importable from inside Python

from auto-07p.

bartoldeman avatar bartoldeman commented on June 13, 2024

@Debilski thanks for the description. I hope to find some time to do the configure make directly via pip install.

@nwaxiomatic
the following works for me without the pip installed package (ie only configure and make):

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/home/oldeman/auto/07p/python')
>>> from auto import *

you can of course also use import auto in which case you need to use auto.run instead of plain run and so on (or if you want a clean namespace otherwise, from auto import run and so on). AUTO_DIR is automatically set correctly to /home/oldeman/auto/07p by the Python code during the import in this case.

from auto-07p.

hkabirju avatar hkabirju commented on June 13, 2024

After following the process mentioned above, some errors come out,

plot('abc')
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/AUTOCommands.py", line 1845, in plot
n1b = bifDiag.bifDiag(n1b,n1s)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/bifDiag.py", line 33, in init
constants)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/bifDiag.py", line 53, in __realinit
raise AUTOExceptions.AUTORuntimeError('\n'.join(ioerrors))
auto.AUTOExceptions.AUTORuntimeError: [Errno 2] No such file or directory: 'b.abc'
[Errno 2] No such file or directory: 's.abc'

Please help me to overcome this problem. Thanks

from auto-07p.

Richert avatar Richert commented on June 13, 2024

I would like to see a PyPI version of Auto-07p as well! (see this issue)

For anyone willing to work with a little wrapper to auto: I wrote a software that adds a little work-around with respect to the environment/path variable issues: https://github.com/pyrates-neuroscience/PyCoBi
It is pip installable, and would merely require a PyPI build for Auto-07p that calls configure, make and python setup.py install. After that, PyCoBi handles the environment variables for you.

It is light-weight, in that it still uses most of the standard syntax that you know from Auto-07p, and provides a few convenient features, such as automated merging of solution branches, automated extraction of eigenvalues, local lyapunov exponents, ...
Furthermore, you can interface Auto-07p to a certain degree completely from within Python, since it comes with a fortran code-generator (based on PyRates) that allows you to define your models either within Python or via YAML definition files. You can still use your own Fortran files if you want though.

from auto-07p.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.