imoprt error when I gave source toaster start in morty - django

I got below error when i run poky/build$ source toaster start.
The system will start.
Traceback (most recent call last):
File "/home/siva/yocto/Morty/poky/bitbake/bin/../lib/toaster/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
......
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/siva/.local/lib/python3.5/site-packages/django/contrib/contenttypes/apps.py", line 7, in <module>
from .management import update_contenttypes
ImportError: cannot import name 'update_contenttypes'
I have seen the below link but I believe That is diiferent than this.
importerror: cannot import name update _all_content

I believe you are using two yocto sources like krogoth and morty.
krogoth depends on python2 and pip
morty depends on python3 and pip3
It might have confused things. So please use below command:
rm -rf /home/siva/.local/lib/python3.5/site-packages/django

You can import like that,
from YourPackageName.management import update_contenttypes

Related

Getting "No module named queue" when installing tensorflow

I am using Anaconda and trying to install tensorflow with pip, but I receive the following error and I am not sure what to do next?
Traceback (most recent call last):
File "/home/xieyangyang/anaconda3/envs/tensorflow1/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_internal/__init__.py", line 20, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 44, in <module>
from .util.queue import LifoQueue
ImportError: No module named queue
Maybe just reinstall pip without pip?
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
See https://pip.pypa.io/en/stable/installing/ for more info.

python PyUserInput import error

Hi I am trying to download PyUserInput, I downloaded it using pip and there were no errors. When I try to import it into a file in give me an error which I do not understand. I have a basic understanding of python and pip.Any help will be much appreciated.I have pasted the error I get below.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from pymouse import PyMouse
File "/usr/local/lib/python2.7/dist-packages/pymouse/__init__.py", line 41, in <module>
from .x11 import PyMouse, PyMouseEvent
File "/usr/local/lib/python2.7/dist-packages/pymouse/x11.py", line 16, in <module>
from Xlib.display import Display
File "/usr/local/lib/python2.7/dist-packages/Xlib/display.py", line 26, in <module>
from six import create_unbound_method
ImportError: cannot import name create_unbound_method
Thanks
I had the same problem on old raspberry pi image and upgrading six solved the issue for me:
sudo pip install six --upgrade

Error on QSTK.qstkstudy on Python 2.7.3

I am trying to install QSTK on my python 2.7.3. (on windows 10). During the installation, it seemed there was no problem and I did not face any errors. However, when I run the validation.py (here) to check it seems that QSTK.qstkstudu cannot be imported. Here is the error that I get while running validation.py:
QSTK is installed and can be imported
[...]
QSTK.qstkutil is installed and can be imported
File "C:\Python27\lib\site.py", line 372, in __call__
raise SystemExit(code)
SystemExit: Error : QSTK.qstkstudy can not be imported.
Does anyone have a clue what should I do?
The line in Validation.py which produces the error is:
import QSTK.qstkstudy.EventProfiler
If you try it directly in python, you can see what is missing. In my case it was tkinter.
>>> import QSTK.qstkstudy.EventProfiler
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkstudy/EventProfiler.py", line 16, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
from matplotlib.externals.six.moves import tkinter as Tk
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 199, in load_module
mod = mod._resolve()
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 113, in _resolve
return _import_module(self.mod)
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 80, in _import_module
__import__(name)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package
I am on Linux so I did
sudo apt-get python-tk
Google how to install python tkinter in Windows.
Good luck

conda update --all = "ImportError: DLL load failed: %1 is not a valid Win32 application." when trying to import matplotlib.pyplot

I use the Python distribution. Python 2.7 x64 with Windows 7 SP1 x64 Ultimate.
After a conda update --all, whenever I try to import matplotlib.pyplot I get ImportError: DLL load failed: %1 is not a valid Win32 application.. Why?
Full error stack:
Traceback (most recent call last):
File "C:\svn\hw4\code\test_con.py", line 1, in <module>
import matplotlib.pyplot as plt
File "C:\Anaconda\lib\site-packages\matplotlib\pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Anaconda\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Anaconda\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 17, in <module>
from .backend_qt5agg import NavigationToolbar2QTAgg
File "C:\Anaconda\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 18, in <module>
from .backend_qt5 import QtCore
File "C:\Anaconda\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
File "C:\Anaconda\lib\site-packages\matplotlib\backends\qt_compat.py", line 91, in <module>
from PyQt4 import QtCore, QtGui
ImportError: DLL load failed: %1 is not a valid Win32 application.
I had the same issue after running conda update anaconda. The solution that worked for me was to simply to download the latest windows installer, then uninstall and reinstall.
I suspect this is related to the pathname of your conda environment, as if you do a clean install anaconda now wants to live in C:\Users\yourname\AppData\Local\Continuum\Anaconda2, where previously it was just Anaconda (no 2). I suspect after running the upgrade scripts some things are pointing to the nonexistant (for you) "new" path.
I found that if I explicitly activate a conda environment with activate myenvname before running anything it works fine. Likewise if you you run from the "anaconda prompt" (which activates your default environment for you) it works fine. But to get my default environment to stay active from anywhere like its supposed to I had to reinstall.
Here is what worked for me:
Run conda update -f matplotlib (from the Anaconda command prompt)
This gave me a new error:
RuntimeError: module compiled against API version a but this version of numpy is 9
Traceback (most recent call last):
File "C:\svn\hw4\code\test_con.py", line 1, in <module>
import matplotlib.pyplot
File "C:\Anaconda\lib\site-packages\matplotlib\pyplot.py", line 27, in <module>
import matplotlib.colorbar
File "C:\Anaconda\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "C:\Anaconda\lib\site-packages\matplotlib\artist.py", line 12, in <module>
from .transforms import Bbox, IdentityTransform, TransformedBbox, \
File "C:\Anaconda\lib\site-packages\matplotlib\transforms.py", line 39, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: numpy.core.multiarray failed to import
Run conda update -f numpy
This gave me a new error:
Traceback (most recent call last):
File "C:\svn\hw4\code\test_con.py", line 1, in <module>
import matplotlib.pyplot
File "C:\Anaconda\lib\site-packages\matplotlib\pyplot.py", line 27, in <module>
import matplotlib.colorbar
File "C:\Anaconda\lib\site-packages\matplotlib\colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "C:\Anaconda\lib\site-packages\matplotlib\collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "C:\Anaconda\lib\site-packages\matplotlib\backend_bases.py", line 56, in <module>
import matplotlib.textpath as textpath
File "C:\Anaconda\lib\site-packages\matplotlib\textpath.py", line 22, in <module>
from matplotlib.mathtext import MathTextParser
File "C:\Anaconda\lib\site-packages\matplotlib\mathtext.py", line 63, in <module>
import matplotlib._png as _png
ImportError: DLL load failed: The specified module could not be found.
Run conda install anaconda. This rolled your system back to a stable anaconda distribtution, and solved the issue. (I guess you could skip steps 1 and 2, but I don't feel like going through it again to confirm…)

Import and Environment Variable issues using Python/Django in PYcharm on Ubuntu

I am working through the PYcharm tutorial, which sets up a polling site, as my first Python/Django project. I am new to this so if I am asking silly questions I apologize in advance. In the admin.py file the following import is not working:
from MyDjangoApp.polls.models import Poll, Choice
I have specified the environment variable as I found in other posts to
DJANGO_SETTINGS_MODULE MyDjangoApp.settings
with MyDjangoApp being my project name and MyDjangoApp.settings as the value in the Edit Configurations tab.
I also tried to follow the lightbulb suggestion to install package models but when I do that I get the following error:
Error occurred when installing packages.
The following command was executed:
packaging_tool.py install --build-dir /tmp/pycharm packaging1986982253689628475.tmp
models
The error output of the command:
Downloading/unpacking models
Downloading models-0.9.3.tar.gz
Running setup.py egg_info for package models
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pycharm-packaging1986982253689628475.tmp/models/setup.py", line 25, in
<module>
import models
File "models/__init__.py", line 24, in <module>
from props import *
File "models/props.py", line 23, in <module>
import yaml
ImportError: No module named yaml
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pycharm-packaging1986982253689628475.tmp/models/setup.py", line 25, in
<module>
import models
File "models/__init__.py", line 24, in <module>
from props import *
File "models/props.py", line 23, in <module>
import yaml
ImportError: No module named yaml
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pycharm
-packaging1986982253689628475.tmp/models
Storing complete log in /home/andrew/.pip/pip.log
I am not sure how to proceed. I have seen a decent amount of suggestions but they either don't work or I'm not doing it correctly. If anyone has any suggestions I would greatly appreciate it. I have been banging my head against this wall most of the day today and I would really like to be able to move forward. Thanks is advance for anyone willing to help out a newbie.
In polls/admin.py do from models import Poll, Choice - this is presuming you have a models.py file next to admin.py.