Code Monkey home page Code Monkey logo

Comments (6)

williamFalcon avatar williamFalcon commented on May 3, 2024

post code here.

Generally in python it would be:

from python_lightning import Trainer

Look at the demo here for instructions:
https://github.com/williamFalcon/pytorch-lightning#how-do-i-do-use-it

from lightning.

sameerIISc avatar sameerIISc commented on May 3, 2024

From command line itself it is not able to import. Importing pytorch_lightning is working though.

import pytorch_lightning
from pytorch_lightning import Trainer
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name Trainer

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024
  Found existing installation: pytorch-lightning 0.3.6.9
    Uninstalling pytorch-lightning-0.3.6.9:
      Successfully uninstalled pytorch-lightning-0.3.6.9
  Running setup.py develop for pytorch-lightning
Successfully installed pytorch-lightning test-tube-0.6.7.6
(lightning) user:~/Developer/pytorch-lightning$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning
>>> from pytorch_lightning import Trainer
>>>

Seems strange. I just tried, it works. Tests also work...

Maybe it's your install?

What does your conda env look like? Are you also using the latest lightning version?

from lightning.

sameerIISc avatar sameerIISc commented on May 3, 2024

Even after re-installation, same problem persists.

(sameer27) ece@ece-System-Product-Name:~$ pip install pytorch_lightning
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pytorch_lightning
Collecting test-tube (from pytorch_lightning)
Requirement already satisfied: torch in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from pytorch_lightning) (1.1.0)
Requirement already satisfied: tqdm in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from pytorch_lightning) (4.32.2)
Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (1.14.0)
Requirement already satisfied: pandas>=0.20.3 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (0.24.2)
Requirement already satisfied: future in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (0.17.1)
Requirement already satisfied: tb-nightly==1.15.0a20190708 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (1.15.0a20190708)
Requirement already satisfied: imageio>=2.3.0 in ./anaconda2/envs/sameer27/lib/python2.7/site-packages (from test-tube->pytorch_lightning) (2.5.0)
Requirement already satisfied: pytz>=2011k in ./.local/lib/python2.7/site-packages (from pandas>=0.20.3->test-tube->pytorch_lightning) (2017.3)
Requirement already satisfied: python-dateutil>=2.5.0 in ./.local/lib/python2.7/site-packages (from pandas>=0.20.3->test-tube->pytorch_lightning) (2.6.1)
Requirement already satisfied: grpcio>=1.6.3 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (1.21.1)
Requirement already satisfied: absl-py>=0.4 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.7.1)
Requirement already satisfied: protobuf>=3.6.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.8.0)
Requirement already satisfied: futures>=3.1.1; python_version < "3" in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.2.0)
Requirement already satisfied: wheel; python_version < "3" in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.33.4)
Requirement already satisfied: werkzeug>=0.11.15 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (0.15.4)
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (3.1.1)
Requirement already satisfied: six>=1.10.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (1.12.0)
Requirement already satisfied: setuptools>=41.0.0 in ./.local/lib/python2.7/site-packages (from tb-nightly==1.15.0a20190708->test-tube->pytorch_lightning) (41.0.1)
Requirement already satisfied: pillow in ./.local/lib/python2.7/site-packages (from imageio>=2.3.0->test-tube->pytorch_lightning) (5.0.0)
Requirement already satisfied: enum34 in ./.local/lib/python2.7/site-packages (from imageio>=2.3.0->test-tube->pytorch_lightning) (1.1.6)
Installing collected packages: test-tube, pytorch-lightning
Successfully installed pytorch-lightning-0.0.2 test-tube-0.6.7.6
(sameer27) ece@ece-System-Product-Name:~$ python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning
>>> from pytorch_lightning import Trainer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name Trainer

from lightning.

williamFalcon avatar williamFalcon commented on May 3, 2024

oh yeah, use python 3+. Recommended 3.7

from lightning.

sameerIISc avatar sameerIISc commented on May 3, 2024

Ok, I will try it. Thanks a lot.

from lightning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.