How to use/update a modified conda package offline

Question:

I have already installed a package on my Linux machine via conda install, but I found an error when running it on Jupyter Notebook. I’m able to make a simple modification to the package’s python script, but the modified code isn’t recognized when I called the package again. Do I need to update the package so that the changes would be recognized, and if so, how do I do that?

Asked By: Rayne

||

Answers:

The library’s code does not get imported directly. Instead, it is compiled the first time you import it and put into a pycache folder in the corresponding site-packages directory. In this folder, locate the .pyc file corresponding to the one that you modified and delete it.

Now, when you import, the source code is compiled anew and your changes will have taken effect.

If the package has a GitHub page, it might be worthwhile to make a pull request and ask that they also update the conda package

Answered By: FlyingTeller