from . import nonlinearities cannot import name nonlinearities - python-2.7

there is some really strange problem.
Traceback (most recent call last):
File "mnist.py", line 17, in
import lasagne.nonlinearities as nonlinearities
File "/usr/local/lib/python2.7/dist-packages/lasagne/init.py", line 17, in
from . import nonlinearities
ImportError: cannot import name nonlinearities
As I go to this folder, I find there is it(the name).but for some unkown reason,(I guess path problem). It does not work.
this may be raised by my mistaking operation, but my mistaking command was not executed.
in detail,originally,my lasagne==0.1.and there is some module can not import..so i solved it by installing the leasted version lasagne==0.2.dev1...then it works.for some reason ,i break my program.before i run it again,i had done some unexecuted mistaking command,now the error is there as you see.i guess it because of two version of lasagne under the path /usr/local/lib/python2.7/dist-packages/..so i uninstall all of them,then i reinstall the one version.but the error is still there..
additional..the following command is ok
python
import lasagne
import lasagne.nonlinearites as nonl

this can be solved by first import lasagne then import theano..
if exchange the import order,then the error arise...
this is very strange.i am not sure what happens,but it does work

Related

PyDSTool with anaconda not installing properly

I am trying to install PyDSTool with anaconda2 (conda install PyDSTool), which seems to go well. But when I open spyder and import PyDSTool, it gives me error
import PyDSTool
Traceback (most recent call last):
File "<ipython-input-1-a214100b00aa>", line 1, in <module>
import PyDSTool
File "/home/user/anaconda2/lib/python2.7/site-packages/PyDSTool/__init__.py", line 76, in <module>
raise RuntimeError("SciPy v0.5.1 or above is required")
RuntimeError: SciPy v0.5.1 or above is required
I tried to change parseUtils.py as per this suggestion: import of package PyDSTool doesn't work
but still the same error. I certainly have SciPy 1.0 and python 2.7.
I ran into this problem recently. The accepted answer here (PyDSTool do not recognize SciPy version) is still effective today at solving this problem.
Basically download PyDSTool from here (https://github.com/tkf/pydstool/tree/tkf) instead of sourceforge.

Already installed Pygame module, but when try to run pygame code it shows error

Traceback (most recent call last):
File "game.py", line 6, in
import random, pygame, sys
ImportError: No module named pygame
im no expert but from my experience but make sure you downloaded the right pygame for 1. your version of python and 2. your system+(32/64 bit).
also make sure in your path you have c:\python27 , c:\python27\scripts.

How can I import the csvsql to Python 2.7

I have successfuly installed csvkit using conda install ...
However, when I try to import the libraries in Python 2.7 Spyder, I get error messages:
import csvsql
Traceback (most recent call last):
File "<ipython-input-5-303a60a6b1ac>", line 1, in <module>
import csvsql
ImportError: No module named csvsql
import csvkit
Traceback (most recent call last):
File "<ipython-input-7-ca8a99ae9834>", line 1, in <module>
import csvkit
ImportError: No module named csvkit
I looked at the documentation -- they describe the installation process but not how the library is loaded in Python.
Moreover, I had an analogous problem with httplib2. I installed it successfuly but when I tried to import it in Spyder I received an analogous error message (No module named httplib2).
(I use Anaconda 3 and Spyder on Windows 11)
Any ideas? Thank you in advance.
I asked this question on the csvkit GitHub / issues forum.
The answer given was: You should use agate on which csvkit now relies for all its operations. See https://github.com/wireservice/agate.
I'm with you -- it would be wonderful to use csvkit as a command-line tool and a library, but it's authors don't see it that way. The full issue: https://github.com/wireservice/csvkit/issues/670

Cannot import pygame into python 2.7

I have tried to import pygame 1.9 into both Python 2.7 and 3.5. I used both Windows 8.1 and 10. In every case, it does not import the file. This is the message I get:
>>> import pygame
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
Pygame is in the python27\include\pygame directory. Any help would be greatly appreciated.
Please follow this question here. It should be an error with missing dlls.
ImportError: DLL load failed: The specified module could not be found

dispersion_plot not working inspite of installing matplotlib

i have installed matplotlib using pip in ubuntu 14.04 LTS.. but on running dispersion_plot this is showing the following error ..
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/nltk/text.py", line 455, in dispersion_plot
from nltk.draw import dispersion_plot
ImportError: cannot import name dispersion_plot
I am new to python... can anyone suggest if there is a better way of installing matplotlib in nltk.
The examples of the online book are not quite right.
You may try this:
from nltk.draw.dispersion import dispersion_plot
words = ['Elinor', 'Marianne', 'Edward', 'Willoughby']
dispersion_plot(gutenberg.words('austen-sense.txt'), words)
You may also call it from a text directly:
from nltk.book import text1
from nltk.draw.dispersion import dispersion_plot
dispersion_plot(text1, ['monstrous'])
this way you import the function directly instead of calling the funcion from text object.
I realized this watching at the source code directly.
Hope this work for you
After importing it using spyder, this is how the plot would look.