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

TypeError: __init__() got an unexpected keyword argument 'environment' in service_factory #296

Closed
valignatev opened this issue Jun 2, 2018 · 30 comments

Comments

@valignatev
Copy link
Contributor

Just updated to 0.1.12 and got this error:

127.0.0.1 - - [03/Jun/2018 02:31:24] ================================================================================
Traceback (most recent call last):
  File "/home/vj/.emacs.d/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 101, in apply
    result = method(**params)
  File "<string>", line 81, in wrapper
TypeError: __init__() got an unexpected keyword argument 'environment'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vj/.emacs.d/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/providers/basehttp.py", line 40, in do_POST
    status, response = self.server.service(data)
  File "/home/vj/.emacs.d/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 50, in __call__
    result = self.apply(method, args)
  File "/home/vj/.emacs.d/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 105, in apply
    server_error(args['id'], error)
  File "/home/vj/.emacs.d/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/errors.py", line 91, in server_error
    raise ServiceException(500, dumps(response))
service_factory.exceptions.ServiceException: (500, '{"jsonrpc": "2.0", "id": 1, "error": {"code": -32000, "message": "Server error", "data": "TypeError(\\"__init__() got an unexpected keyword argument \'environment\'\\",)"}}')
@valignatev
Copy link
Contributor Author

Downgrading to 0.1.11 and it's working, so something between these releases might've been broken

@proofit404
Copy link
Contributor

Hi, can you provide more details about the virtual environment? Also, provide your emacs settings.

@valignatev
Copy link
Contributor Author

Sure, for this one I don't use virtual environment, so it's my global python (which is 3.6.5, with jedi 0.12)
Emacs settings are these:

(use-package anaconda-mode
  :hook ((python-mode . anaconda-mode)
         (python-mode . anaconda-eldoc-mode))
  :config
  (use-package company-anaconda
    :requires company
    :config (add-to-list 'company-backends 'company-anaconda)))

I'm using use-package, but it's basically the same as in readme

@proofit404
Copy link
Contributor

Hm... I have exactly the same settings, can't reproduce at all. Are you familiar with python hunter tracing tool?

@valignatev
Copy link
Contributor Author

Just looked it up, looks interesting. I'll try to debug it further and provide more details.

@proofit404
Copy link
Contributor

Cool, thanks! Let me know if you need further assistance.

@valignatev
Copy link
Contributor Author

valignatev commented Jun 3, 2018

Well, that's weird, I wanted to do a clean experiment and pruned anaconda-mode to set up 0.1.12 from scratch. And now it works, I can't reproduce the error myself again. So I'll guess I will close the issue, and maybe reopen if an error occurs again. ¯\_(ツ)_/¯

@diegotsutsumi
Copy link

I have the same error here, did a clean up and it keeps the same, couldn't fix it

@psubnwell
Copy link

I met the same problem, then I use pip install --upgrade "jedi>=0.9.0" "json-rpc>=1.8.1" "service_factory>=0.1.5" to satisfy the dependencies. It works~

@proofit404
Copy link
Contributor

Why do you need json-rpc?

@diegotsutsumi
Copy link

I have the latest version of anaconda-mode installed fmo melpa in my Emacs set up. For some random reason I checked out v0.1.11 in another folder to try it. Back then there was a file called setup.py , I ran the command "python3 setup.py install", for some reason everything started working again.

Now my question is, I have latest version of anaconda-mode installed in my Emacs, but I ran the python installation script of v0.1.11, hehe did I mess up everything? Was it expected to start working again by running the "setup.py install"?

@valignatev
Copy link
Contributor Author

@diegotsu Here comes the deps installation code: https://github.com/proofit404/anaconda-mode/blob/master/anaconda-mode.el#L98-L119
I guess at this point you'd better just prune anaconda-mode, install it from the beginning and try again :) Also, don't forget .emacs.d/anaconda-mode dir, it's the place when python dependencies go.

@proofit404
Copy link
Contributor

Anaconda mode does not require setup.py anymore. It should handle all necessary information under the hood. Everything you need to do is install anaconda-mode from Melpa.

@psubnwell
Copy link

@proofit404 Hmmm... it's a magic command (for me) I heard from community, I'm not sure if json-rpc is necessary. 😅

@proofit404
Copy link
Contributor

json-rpc dependency was removed in 2015. Feel free to uninstall it.

@NathanLovato
Copy link

NathanLovato commented Jun 22, 2018

Got the same error this morning, then checked https://github.com/proofit404/anaconda-mode/blob/master/anaconda-mode.el#L98-L119 -> the issue was jedi 0.11 was installed instead of the minimal 0.12 anaconda-mode requires. Fixed with

pip install --upgrade jedi

The dependency check doesn't account for the lib's version so it'll fail silently if jedi is not up to date:

try:
    import jedi
except ImportError:
    missing_dependencies.append('jedi>=0.12')

@proofit404
Copy link
Contributor

pip completely fucked up in python homebrew installation for all MacOS users.

Unfortunately, we can't use it.

If you can trick easy_install to upgrade packages during installation, please submit PR with version check.

@jaknel
Copy link

jaknel commented Jul 2, 2018

Thanks @NathanLovato

Upgrading jedi from 0.10.2 to 0.12.1 resolved this issue for me.

@thnbp24
Copy link

thnbp24 commented Oct 1, 2018

I still have the exact same issue even with jedi 0.12.1.
The error is gone if I disable anaconda-eldoc-mode.
I use the latest spacemacs and the python 3.5 and anaconda-mode 0.1.12.
Any idea? Thanks.

@proofit404
Copy link
Contributor

Please try to cleanup cache directories.

@thnbp24
Copy link

thnbp24 commented Oct 1, 2018

Thanks for quick reply. I just cleaned up the .emacs.d/.cache directory but the issue still exists.
I am inside virtual environment with all the dependencies described above installed.
The issue can be reproduced by downloading spacemacs and error would show on any python files.

Traceback (most recent call last):
File "/home/jfk/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/providers/basehttp.py", line 40, in do_POST
status, response = self.server.service(data)
File "/home/jfk/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 50, in call
result = self.apply(method, args)
File "/home/jfk/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 105, in apply
server_error(args['id'], error)
File "/home/jfk/.emacs.d/.cache/anaconda-mode/0.1.12/service_factory-0.1.5-py3.6.egg/service_factory/errors.py", line 91, in server_error
raise ServiceException(500, dumps(response))
service_factory.exceptions.ServiceException: (500, '{"jsonrpc": "2.0", "id": 1, "error": {"code": -32000, "message": "Server error", "data": "TypeError(\"init() got an unexpected keywo
rd argument 'environment'\",)"}}')

@thnbp24
Copy link

thnbp24 commented Oct 2, 2018

The issue only happens with spacemacs. I don't have the issue with emacs prelude. It may have something to do with the configuration of spacemacs. I'll switch to emacs prelude then.

@valignatev
Copy link
Contributor Author

@thnbp24 I tried it with spacemacs today and couldn't reproduce it. I wonder if it somehow uses an old version of jedi which it gathers from some deep and dark corners of your sys.path :)

Also interesting if #327 could fix this issue for good.

@thnbp24
Copy link

thnbp24 commented Oct 5, 2018

Thank you @valignatev . Hmm. You're right. Not sure what happened to my virtualenv. I'll stick with prelude for now.

@jingpengw
Copy link

I have the same issue in SpaceVim

@proofit404
Copy link
Contributor

Hi @jingpengw

What what anaconda mode version do you use?

What python libraries it installed?

Regards, Artem.

@raphtoubi
Copy link

I have a similar problem. I've updated everything like said before but I still have this error
Someone has an idea on how to deal with this error ?
error

@proofit404
Copy link
Contributor

Anaconda-mode does not use uvicorn or click packages. You problem related to something else.

@raphtoubi
Copy link

@proofit404 could you tell me more about this ? My problem is related to what then ?

@proofit404
Copy link
Contributor

You use issue tracker of the wrong project.

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

9 participants