Emacs as a FEniCS IDE, no completion


Using FEniCS 2018.1.0 from official repositories on Debian stable (10.9). No issues running the tutorials but I cannot get any dolfin python completions in Emacs (Spacemacs). Other Python modules complete just fine.

Tried adding /usr/lib/python3/dist-packages/dolfin to PYTHONPATH and LD_LIBRARY_PATH but didn’t make a difference. Any help? Should I perhaps install from pip and/or create a virtual environment?

Thanks :slightly_smiling_face:

So I ended up installing dolfin and fenics in a python3 venv. Completions and definitions work flawlessly now for the price of maintaining a venv. Kinda frustrating though not finding an easy way to get things to work with software from the Debian repos. Will probably change when python2 is ditched in Debian 11, hopefully.

spacemacs is not available as a Debian package, which is probably why it doesn’t integrate easily. Let us know if you find a way of integrating it without using venv.

My most likely cause is a hardcoded “python” option somewhere in the spacemacs layers that ties anaconda-mode to python2, which is still the default python on Debian stable 10.10. Not sure it’s worth it to spend more time investigating this because the next Debian stable (11) is just around the corner and uses python3 as default. Not sure why Debian is delaying the transition of 11 to stable but this glitch is very likely to go away if I just ignore it a bit longer :neutral_face:

No delay, the new release is right on schedule, Re: Finding a tentative bullseye release date

Note that if a hardcoded python is the problem, eliminating python2 won’t automatically fix that. There is no default “python” in Debian, /usr/bin/python has been removed, applications are expected to specify python3 (or python2). The python-is-python3 package might help though. It’s a “compromise” package which provides /usr/bin/python, pointing it at python3. It might be already available for you, if so give it a try. It’s not installed by default. (A python-is-python2 package also exists, for those that absolutely need /usr/bin/python to be python2).

Note also you can upgrade already, no need to wait for official release. Just update your sources in /etc/apt/sources.list to bullseye (or to testing)

1 Like

python-is-python3 is only available in Debian Sid (unstable). Won’t help here.

Better wait until the official release to upgrade because it’s usually more polished. Fingers crossed for the July 31 projection. It was supposed to be May, and then the usual June. Will probably happen in August…

No, python-is-python3 is in bullseye (testing).

Yes you’re right.

I don’t understand though why this package is available in versions 11+ cause python3 is the standard there and python2 is deprecated, available as an optional package.

python3 on debian is /usr/bin/python3. There is no /usr/bin/python unless you install python-is-python3.

1 Like

Okay, got it. I also checked the Debian Python policy page and it seems python2 will still be available until Debian 12 becomes stable release. They also provide python-is-python2 to set unversioned /usr/bin/python to /usr/bin/python2.

I hope this works for completions in spacemacs cause I had already tried update-alternatives to set python as python3 and it did not fix my issue. We’ll probably see the same issues coming up again with python4 when it is introduced. Good thing I set up the venv.