Strange, PyTorch must be installed in Jupyter, otherwise it cannot be imported

Several students have reported that after creating a virtual environment and installing Jupyter and torch via pip in the terminal, checking the torch version in Jupyter results in an error saying that torch cannot be imported.

For example:

https://forum.beginner.center/t/topic/306/2

However, after testing by several people, if you install Jupyter with pip in a brand new virtual environment through the terminal, and then install torch within Jupyter, it works normally.

https://forum.beginner.center/t/topic/306/20

Although there are ways to fix it, it’s unclear why this happens.

@honeymoose Could you please explain?

A student’s reply

It might be an issue with the Jupyter kernel path

https://zhuanlan.zhihu.com/p/390887467?utm_campaign=shareopn&utm_medium=social&utm_oi=1558093066921267200&utm_psn=1666912891415572481&utm_source=wechat_session

@王白水

I did not see your message, and it seems the email was not replied to me either, so I have not responded to this message.

Due to recent work needs, I may need to do some research on Python and hope to make progress together with you.

For Python configuration and discussion content, please refer to the link on the website: iSharkFly - 飞鲨

Thank you very much.

1 Like

Let’s progress together! I’m mainly focusing on artificial intelligence and have been studying some classical models recently. Future related content will still be posted on ossez. Currently, I’m the only one interested in programming here in Shitu :joy:

Users vary across different sites.

Haha, no problem.

Let’s improve together. :slight_smile:

1 Like