what's wrong with my keras.using theano backend - deep-learning

i am learning to use deeping learning to deal with physics problem.when i want to run my program by theano,there are some bad things happended.
~$ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import theano
Traceback (most recent call last):
File "", line 1, in
File "theano.py", line 1
%!PS-Adobe-3.0
^
SyntaxError: invalid syntax
import keras
Using Theano backend.
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/keras/init.py", line 3, in
from . import utils
File "/usr/local/lib/python2.7/dist-packages/keras/utils/init.py", line 6, in
from . import conv_utils
File "/usr/local/lib/python2.7/dist-packages/keras/utils/conv_utils.py", line 3, in
from .. import backend as K
File "/usr/local/lib/python2.7/dist-packages/keras/backend/init.py", line 80, in
from .theano_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 3, in
import theano
File "theano.py", line 1
%!PS-Adobe-3.0
^
SyntaxError: invalid syntax

Related

Facing such problem like no model name edge tpu found and no module name edgeTPU_cpp_wrapper

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_edgetpu_cpp_wrapper', [dirname(file)])
File "/usr/lib/python3.9/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_edgetpu_cpp_wrapper'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/DeepPiCar/models/object_detection/code/coco_object_detection.py", line 9, in <module>
import edgetpu.detection.engine
File "/usr/local/lib/python3.9/dist-packages/edgetpu/detection/engine.py", line 17, in <module>
from edgetpu.basic.basic_engine import BasicEngine
File "/usr/local/lib/python3.9/dist-packages/edgetpu/basic/basic_engine.py", line 17, in <module>
from edgetpu.swig.edgetpu_cpp_wrapper import BasicEnginePythonWrapper
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 28, in <module>
_edgetpu_cpp_wrapper = swig_import_helper()
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 20, in swig_import_helper
import _edgetpu_cpp_wrapper
ModuleNotFoundError: No module named '_edgetpu_cpp_wrapper'
Tyring to open up object detection program through edgeTPU. ERROR !! NO Module Found.
Edge TPU API is deprecated. Please modify your code/project to work with pycoral API

How to fix 'AttributeError: type object 'pyfmi.fmi.ModelBase' has no attribute '__reduce_cython__''

I am importing pyfmi and get this error message. I am using Spyder (Python 3.6) on windows.
I also downloaded the latest version of Cython 0.29.13
import pyfmi
Traceback (most recent call last):
File "<ipython-input-11-df481fa81f2d>", line 1, in <module>
import pyfmi
File "C:\ProgramData\Anaconda3\lib\site-packages\pyfmi\__init__.py", line 24, in <module>
from .fmi import FMUModel, load_fmu, FMUModelME1, FMUModelME2
File "src\pyfmi\fmi.pyx", line 165, in init pyfmi.fmi
AttributeError: type object 'pyfmi.fmi.ModelBase' has no attribute '__reduce_cython__'

OSError: libcudart.so.9.2: cannot open shared object file: No such file or directory

trying to run a script, when i get
(infacepytorch) ryan#ryan-7570:/media/ryan/shakira/InsightFace_Pytorch$ python face_verify.py
Traceback (most recent call last):
File "face_verify.py", line 9, in <module>
from Learner import face_learner
File "/media/ryan/shakira/InsightFace_Pytorch/Learner.py", line 1, in <module>
from data.data_pipe import de_preprocess, get_train_loader, get_val_data
File "/media/ryan/shakira/InsightFace_Pytorch/data/data_pipe.py", line 12, in <module>
import mxnet as mx
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/base.py", line 213, in <module>
_LIB = _load_lib()
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/base.py", line 204, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcudart.so.9.2: cannot open shared object file: No such file or directory
I have tried
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 && sudo ldconfig
but i still get the same error,
Any suggestions would be really helpfull, Thanks in advance.
As pointed out by talonmies you're running a version of MXNet that depends on Cuda-9.2. It would be preferable to install Cuda-9.2 and update your library path to point to 9.2.
You can also also install MXNet for 9.0 using the pip package mxnet-cu90 if you were unable to update your Cuda dependencies.

No module named constants error

I have a project in progress. In this project I have to change some reports that they implement by XML code.
When I run my project with "python manage.py runserver"it runs truthfully and I can change my XML code and see the HTML files on chrome but when I want to see the PDF file of reports I get an error that says:
>"IndexError, your list is out of range"
so I start to debug it, in this process debugger said
"from django.db.models.constants import LOOKUP_SEP No module named constants".
this is whole trace back:
>Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace instance at 0x7f45ea1f3b48>
Traceback (most recent call last):
File "/home/rajabi/pycharm-community-2017.1.4/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 589, in __call__
return self.original_func(*self.args, **self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 67, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/rajabi/Desktop/tina/clone-2017-07-05/rtis/src/saed/activities/models.py", line 7, in <module>
from saed.activities.base import models
File "/home/rajabi/Desktop/tina/clone-2017-07-05/rtis/src/saed/activities/base/models.py", line 16, in <module>
from model_utils.managers import InheritanceManager
File "/usr/local/lib/python2.7/dist-packages/model_utils/managers.py", line 13, in <module>
from django.db.models.constants import LOOKUP_SEP
ImportError: No module named constants
what should I do?
django==1.4
python==2.7.12
tastypie == 0.9.16
I can't change my django and python version.
This part of the traceback is showing you that the error is coming from django-model-utils.
File "/usr/local/lib/python2.7/dist-packages/model_utils/managers.py", line 13, in <module>
from django.db.models.constants import LOOKUP_SEP
The release notes say that support for Django 1.4 was dropped in version 3.0.
You could try installing an early version of django-model-utils, but really you should upgrade Django. Django 1.4 is years out of date and insecure.

nltk successfully installed, but now I can't import it

I just installed nltk and now it's not working, and I need assistance figuring out what's wrong.
I followed the install guide here [https://pythonprogramming.net/tokenizing-words-sentences-nltk-tutorial/][1]
Installed via pip
sudo pip install nltk
Then I launched python and downloaded all components
# python3
>>> import nltk
>>> nltk.download()
This worked, and it downloaded all the components(I chose all). After which I figured I was good to go. However, then I went to write my first script and it errored out on the 1st line which imported nltk.
Now when I open the python interpreter I get
# python3
>>> import nltk
"2016-03-02 04:34:03,630","regex.py","ERROR","There is a problem with your SQL query: SELECT regex, regex_id FROM regex WHERE type = 'date'"
Traceback (most recent call last):
File "/home/nick/booze-dev/regex.py", line 10, in <module>
cursor.execute(SQL) # Execute SQL
NameError: name 'cursor' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/nltk/__init__.py", line 128, in <module>
from nltk.chunk import *
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/api.py", line 15, in <module>
from nltk.chunk.util import ChunkScore
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/util.py", line 13, in <module>
from nltk.tag.mapping import map_tag
File "/usr/local/lib/python3.4/dist-packages/nltk/tag/__init__.py", line 63, in <module>
from nltk.tag.sequential import (SequentialBackoffTagger, ContextTagger,
File "/usr/local/lib/python3.4/dist-packages/nltk/tag/sequential.py", line 25, in <module>
from nltk.classify import NaiveBayesClassifier
File "/usr/local/lib/python3.4/dist-packages/nltk/classify/__init__.py", line 98, in <module>
from nltk.classify.textcat import TextCat
File "/usr/local/lib/python3.4/dist-packages/nltk/classify/textcat.py", line 47, in <module>
import regex as re
File "/home/nick/booze-dev/regex.py", line 14, in <module>
sys.exit("Aborting script execution")
NameError: name 'sys' is not defined
I didn't get that error the 1st time I ran the import and executed nltk.download(), so I'm not understanding why I'm getting it now.
I've tried executing python as root and my normal user, and get the same error.
If I check my sys.path
>>> import sys
>>> sys.path
['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
I can find nltk under /usr/local/lib/python3.4/dist-packages:
# ls /usr/local/lib/python3.4/dist-packages | grep nltk
nltk
nltk-3.1.egg-info
So it should be available. So why am I getting an error when importing now?