Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Distutils was imported before Setuptools" when opening a .ipynb file?

If I try to open my Rscript.ipynb file via Windows Explorer I get the following warning and my file does not open.

c:\Users\kirst\anaconda3\lib\site-packages\setuptools\distutils_patch.py:25 UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable errors. Please use setuptools 'objects directly or at least import setuptools first.

Warning

If I first open the Jupyter Notebook using a shortcut with the following target

C:\Users\kirst\anaconda3\python.exe C:\Users\kirst\anaconda3\cwp.py C:\Users\kirst\anaconda3\envs\R C:\Users\kirst\anaconda3\envs\R\python.exe C:\Users\kirst\anaconda3\envs\R\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"

and then open the notebook by browsing to it, I don't have problems.

How do I set up to be able to open the file from explorer?

like image 894
Kirsten Avatar asked Oct 20 '25 15:10

Kirsten


2 Answers

I found a solution at https://github.com/brian-team/brian2/issues/1213#issuecomment-673490152

You need to upgrade to the latest version:

pip3 install --upgrade pip setuptools

and the warning will disappear.

like image 138
Grzesik Avatar answered Oct 23 '25 06:10

Grzesik


I'm copy-pasting an answer from a github user with the same problem and this solution seemed to work like a charm for me. Here is what you need to type on your command prompt:

pip uninstall pyzmq

(you might need to confirm the choice by entering y) and once that is done type:

pip install pyzmq

it might help. I had a similar problem while opening jupyter notebook. that fixed it.

like image 25
user15378917 Avatar answered Oct 23 '25 04:10

user15378917



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!