pappasam / coc-jedi

coc.nvim wrapper for https://github.com/pappasam/jedi-language-server
MIT License
229 stars 9 forks source link

Installing coc-jedi on isolated computer #22

Closed mike-lloyd03 closed 3 years ago

mike-lloyd03 commented 3 years ago

This may sound like a weird request, but I'm trying to move my whole vim configuration over to another computer that has no internet access. My approach is to move .vimrc, .vim, and .config/coc to the $HOME directory for my user on the other computer.

When I try to start vim, it tries to install jedi-language-server in ~/.config/coc/extensions/node_modules/coc-jedi/.venv and fails because pip cannot connect to pypi.org. I'm assuming it tries to install the language server because the venv is dead as the paths in the .venv/bin/activate scripts are different (the username on the isolated computer is different than on the machine I set up vim on).

To fix the venv activation scripts, I tried: sed -i -e 's|/home/old-username|/home/new-username|s' .venv/bin/*

I'm able to manually activate the venv and pip list correctly shows the needed packages installed. However, when I run vim again, it seems to be deleting and recreating the venv directory which of course fails to load the language server package. Is there a way I can avoid this step and use the venv as is?

mike-lloyd03 commented 3 years ago

The isolated computer uses Python 3.7 and the files I'm transferring from use Python 3.8 so I'm guessing that's also why the venv is dead. (No way to upgrade to 3.8).

I created a new .venv directory with Python 3.7 on the isolated computer and manually installed the following packages into the .venv/lib/python3.7/site-packages by copying them from the Python 3.8 venv (they all appear to be backwards compatible with Python 3.7):

The venv already had pip 19.2.3 and setuptools 41.2.0 installed so I left those as is.

I activated the venv and pip list shows all of these packages and their versions correctly, but trying to run jedi-language-server from the command line spits out a python error traceback which originates with:

Traceback (most recent call last):
...
File ".../site-packages/jedi_language_server/initialize_params_parser.py", line 19, in <module>
    from cached_property import cached_property # type: ignore
ModuleNotFoundError: No module named 'cached_property'

I cannot give you full traceback because I cannot move files off of this computer.

mike-lloyd03 commented 3 years ago

Whelp. I installed cached_property 1.5.1 and now everything is fine. Thank you for reading the documentation of my adventure.

I'm not really sure why cached_property wasn't installed in the original 3.8 .venv directory but whatevs.