Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem importing dyneusr; matplotlib TkAgg backend #8

Open
jsmentch opened this issue Mar 24, 2020 · 8 comments
Open

Problem importing dyneusr; matplotlib TkAgg backend #8

jsmentch opened this issue Mar 24, 2020 · 8 comments

Comments

@jsmentch
Copy link
Contributor

I've been trying to install dyneusr on a singularity image and cannot import it in python. I seem to be having an issue with matplotlib backend TkAgg. I installed using pip after installing the dependencies and this is on debian stretch. Have you come across this problem or know a possible solution? Thanks!

I have tried restarting the kernel and importing before anything else. I've also tried downgrading to matplotlib 3.0.3. These were the only solutions I could find online.

Here is the error I receive after trying to import dyneusr:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/dyneusr/__init__.py", line 18, in <module>
    from . import tools
  File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/dyneusr/tools/__init__.py", line 8, in <module>
    from . import mixture
  File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/dyneusr/tools/mixture.py", line 23, in <module>
    mpl.use('TkAgg', warn=False)
  File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/matplotlib/__init__.py", line 1391, in use
    switch_backend(name)
  File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/matplotlib/pyplot.py", line 222, in switch_backend
    newbackend, required_framework, current_framework))
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
@calebgeniesse
Copy link
Collaborator

@jsmentch, thanks for reporting!

definitely looks familiar, and pretty sure it is due to some lazy coding on my part

sorry for the delay, but should have this resolved for you ASAP

@calebgeniesse
Copy link
Collaborator

removing all the calls to matplotlib.use should get rid of the errors (see #9)

@calebgeniesse
Copy link
Collaborator

went ahead and merged the relevant changes into master with pull request #9

@jsmentch, hope this does the trick, but let me know if you have any other problems!

@jsmentch
Copy link
Contributor Author

That worked, I can now run the sample notebooks with no issues, thank you!!

I'm still having trouble installing it in a singularity recipe but that is unrelated and on my end w/ github/singularity/neurodocker and for now can work around this. Thanks again.

@calebgeniesse
Copy link
Collaborator

@jsmentch Awesome, thanks for letting me know.

I am not too familiar with singularity/docker/etc, but let me know if there's anything else I can do to help!

And if you (or anyone from the future) figure out how to setup a container, feel free to share/contribute your findings (i.e., see Issue #1, or submit a new pull request)

@jsmentch
Copy link
Contributor Author

If there is an updated simple pip install or conda install version released online sometime then I may be able to create a container using neurodocker for that release.

As I learn how to use containers if I'm able to do that or install from source I will make a pull request

@calebgeniesse
Copy link
Collaborator

Not sure what neurodocker expects, but technically, you can run

pip install git+git://github.com/braindynamicslab/dyneusr.git

Otherwise, I will try to push an updated build to pypi.org as soon as possible.

And that'd be great, thanks!

@calebgeniesse
Copy link
Collaborator

@jsmentch, just uploaded the latest build, dyneusr==0.3.5!

https://pypi.org/project/dyneusr/

let me know if you have any problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants