Python ide for pytorch

Hi, all,

Which python ide would you suggest for pytorch?
I’d like to link to corresponding pytorch implementation code when I click the keywords of pytorch. Also autocompletion function is desired.

1 Like

Personal opinion: I’ve used Sublime for ages, and no major painpoints. Handles pep8, flake8, syntax highlighting. Can even handle auto-detecting tab indent sizes and such, which would have been handy in the old luatorch world :smiley:

I highly recommend PyCharm, and it’s free if you are currently a student (they offer a free license to students).
But I don’t think it has specific PyTorch integration (i.e autocomplete for modules / submodules).

3 Likes

+1 for PyCharm, I use it everyday (with pytorch)

4 Likes

It isn’t an IDE, but I have come to like jupyter a lot, in particular since my pytorch computer is in the basement and I use my notebook computer to connect.
It does tab completion but only shows the source code on ??.
On the up side, it neatly includes graphical output.
I did need a (very clumsy because it just replays everything) workaround for reconnecting https://github.com/jupyter/notebook/issues/1150 to be able to shut down the laptop and allow reconnecting.

Best regards

Thomas

1 Like

Emacs with elpy, all the IDF features (autocomplete…), and it works under the console (pure text).

@miguelvr, @tessler, have you faced the issue where PyCharm debugging is very slow while printing / viewing tensors? On my system, printing even small ones takes more than 10s. Normal IPython debugging using Tracer()() is fine.
I’ve reported it here: https://intellij-support.jetbrains.com/hc/en-us/requests/1034832

1 Like

My debug mode runs smoothly. Either in my local computer (Mac) or the deployment machine (Linux)

1 Like

I have the same setup, and it works perfectly. The only issues I encountered is that it skips any breakpoints that are inside a backward() method of a custom-defined function (for whatever reason) but otherwise it’s very good!

I find Vim and tmux to be best if I’m working on a remote server. Otherwise I prefer Spyder.

What spyder version are you using in combination with pytorch?
I’m having problems getting it all working together. Not sure whether pytorch or spyder is causing the problem.
Tried so far:
-python 2.7
-pytorch 0.12.1, 0.2.0, from source
-ipython 4.10, 5.6
-spyder 3.2.4

Current setup:
Python 3.6
pytorch 0.2.0_4
ipython 5.3.0
spyder 3.2.3

I’ve tried pytorch in multiple python/spyder versions in the past and have never had any problems.

can you please tell me the procedure to use pytorch in pycharm. I am trying to add the torch, pytorch library in pycharm but it shows error.

can u plz list the procedure for using pytorch in pycharm

chose an interpreter, I recommend you use a conda environment or a virtualenv, install pytorch in that env, and then it works just as any python library

yeah i got it installed . I have an Nvidia gpu with my machine , do i need to install Nvidia and cuda drivers separately before pytorch installation to use the GPU

Yes, you need to have the appropriate GPU driver installed to use PyTorch with GPU.

vscode and vim :smiley: :grin:

Depends on the kind of system you are using.
Bigger RAM and good GPU PyCharm and pytorch awesome combination.
Laptop i’m using core i5 8th gen, only 4GB RAM with Geforce MX150 2GB, have CUDA 10.0 on lubuntu, hard on system to use Pycharm and pytorch at same time.

Need to have only three applications open when i’m trying to train a NN.
Terimal - to execute the file for training.
Task Manager - to check the system usage or to kill a task.
Sublime text - to edit the file.

Works like a charm.

For those facing the slow debug/step issue, an easy fix is to change variable loading policy to On demand

https://www.jetbrains.com/help/pycharm/variables-loading-policy.html

1 Like