Giter VIP home page Giter VIP logo

jedi 0.18.0 incompatibilities - anaconda-eldoc-mode causes TypeError: __init__() takes from 1 to 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given about anaconda-mode HOT 14 CLOSED

Mekk avatar Mekk commented on August 27, 2024 1
jedi 0.18.0 incompatibilities - anaconda-eldoc-mode causes TypeError: __init__() takes from 1 to 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given

from anaconda-mode.

Comments (14)

Mekk avatar Mekk commented on August 27, 2024 2

For the sake of possible Doom! Emacs users, adding to packages.el:

(package! anaconda-mode
  :recipe (:host github :repo "dakra/anaconda-mode")
  :pin "810163d5a65e62d58f363e2edaa3be70e6d82e25")

switches to this patched version.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024 1

Doom emacs uses anaconda 0.1.13 and jedi 0.18.0. Jedi sources have the following there:

def __init__(self, code=None, *, path=None, environment=None, project=None):

so looks like giving positional args is not supported here.

from anaconda-mode.

dakra avatar dakra commented on August 27, 2024 1

I merged the PR and also created a new version tag so users of melpa-stable will get it too.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

I patched anaconda slightly to give more detail about what was called (simply by extending error message to note which called function crashed) and here it is:

service_factory.exceptions.ServiceException: (500, '{"jsonrpc": "2.0", "id": 1, "error": {"code": -32000, "message": "Server error: Calling <function eldoc at 0x7f7c79d31160> with named args: source=..., line=17, column=11, path=\'/home/marcink/GAUSS/python/sfx__repository/sample/repo/basic_log.py\'", "data": "TypeError(\'__init__() takes from 1 to 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given\')"}}')

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

I am not 100% sure, but it seems to me that aforementioned line 99 is related to python code snippet defined inside anaconda-mode-server-command. If so, it is triggered by:

result = f(jedi.Script(source, line, column, path, environment=virtual_environment))

what also matches error message

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

I resolved this by changing to

result = f(jedi.Script(source, path=path, environment=virtual_environment))

but then next error appears:

Traceback (most recent call last):
  File "/home/marcink/DEV_git/emacs/doom-emacs/.local/etc/anaconda/0.1.13/service_factory-0.1.6-py3.8.egg/service_factory/service.py", line 101, in apply
    result = method(**params)
  File "<string>", line 100, in wrapper
  File "<string>", line 156, in eldoc
AttributeError: 'Script' object has no attribute 'call_signatures'

so looks like there is some deeper incompatibility.

0.18.0 seems to be the newest and brightest version of jedi, so I bet it changed in incompatible way at some moment.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

Jedi changelog mentions deprecating call_signatures in entry for 0.16.0.
Looking at the repo, it seems the method was actually removed at 0.18.0 (0.17.2 has it).

So I suppose this bug is about patching anaconda to work with jedi 0.18.0.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

As a side note, it seems anaconda-mode.el doesn't restrict jedi version installed: it constructs pip dependency jedi>=0.13.0 but doesn't limit upper version. Probably it would be better to limit two-side.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

I reported the latter problem separately, as #402. This issue is about making anaconda work with jedi 0.18.0

from anaconda-mode.

dakra avatar dakra commented on August 27, 2024

By default anaconda installs a rather old version 0.13.

0.18 is only 6 days old though and not a good choice for anaconda as
it doesn't have python 2 support.

But I agree that anaconda should also work with 0.18 if that's installed.
Would be great if you can help with a PR that supports both (all) jedi versions.

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

Unfortunately anaconda doesn't install jedi 0.13 by default. It installs newest version available on pypi at the moment (it asks for jedi>=0.13 what since Dec 25th results in 0.18). But that's #402.

PS Force-downgrading jedi to 0.17.2 seems to help (alth. I tested it very briefly). So I'd suggest starting from #402 and adding <0.18 restriction for jedi there, to resolve the immediate issue.

from anaconda-mode.

dakra avatar dakra commented on August 27, 2024

@Mekk Can you check if #403 works ?

from anaconda-mode.

Mekk avatar Mekk commented on August 27, 2024

I tested it briefly and seems it is OK (jedi 0.18 was installed but now I don't see errors and eldoc hints are displayed).

from anaconda-mode.

mrBuran avatar mrBuran commented on August 27, 2024

@Mekk Can you check if #403 works ?

Works fine for me too, thanks!

Recently I upgraded python to 3.9 on my laptop and rebuild all environments, anaconda-mode was broken due to installed fresh version of jedi.

Thanks @dakra for his patch, it solved the problem!

from anaconda-mode.

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.