ImportError regarding AppKit module in Psychopy - python-2.7

I recently downloaded PyObjC to my Mac OS X El Capitan version 10.11.3, so that I could import the AppKit module in PsychoPy. When I attempted to run my script though I received the following error:
ImportError: The 'packaging' package is required; normally this is bundled with this
package so if you get this warning, consult the packager of your distribution.
I had read online that downgrading setuptools to version 19.2 will help, so I did that but am still running into the same error in PsychoPy. Is there some other way to address this error or am I doing something wrong?
Edit:
Here is the complete error message that I receive:
Traceback (most recent call last):
File "/Users/Dustin/Desktop/CMNT/CMNT.psychopy.py", line 8, in <module>
from AppKit import NSScreen
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/AppKit/__init__.py",
line 8, in <module>
import objc
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/objc/__init__.py", line 32, in <module>
from objc._bridgesupport import *
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/objc/
_bridgesupport.py", line 13, in <module>
import pkg_resources
File "pkg_resources/__init__.pyc", line 75, in <module>
File "pkg_resources/extern/__init__.pyc", line 60, in load_module
ImportError: The 'packaging' package is required; normally this is bundled with this
package so if you get this warning, consult the packager of your distribution.

Related

Error in launching TensorBoard

I have installed TensorBoard. Before launching, I have also written the code in my neural network training file.
sess = tf.Session()
writer = tf.summary.FileWriter("demo")
writer.add_graph(sess.graph)
When i try to launch TensorBoard from terminal, using this command tensorboard --logdir=logs/
I get this error.
Traceback (most recent call last):
File "/usr/local/bin/tensorboard", line 7, in <module>
from tensorboard.main import run_main
File "/usr/local/lib/python3.4/dist-packages/tensorboard/main.py", line 40, in <module>
from tensorboard import default
File "/usr/local/lib/python3.4/dist-packages/tensorboard/default.py", line 37, in <module>
from tensorboard.plugins.audio import audio_plugin
File "/usr/local/lib/python3.4/dist-packages/tensorboard/plugins/audio/audio_plugin.py", line 30, in <module>
from tensorboard.plugins.audio import metadata
File "/usr/local/lib/python3.4/dist-packages/tensorboard/plugins/audio/metadata.py", line 22, in <module>
from tensorboard.plugins.audio import plugin_data_pb2
File "/usr/local/lib/python3.4/dist-packages/tensorboard/plugins/audio/plugin_data_pb2.py", line 22, in <module>
serialized_pb=_b('\n+tensorboard/plugins/audio/plugin_data.proto\x12\x0btensorboard\"}\n\x0f\x41udioPluginData\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x37\n\x08\x65ncoding\x18\x02 \x01(\x0e\x32%.tensorboard.AudioPluginData.Encoding\" \n\x08\x45ncoding\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03WAV\x10\x0b\x62\x06proto3')
TypeError: __new__() got an unexpected keyword argument 'serialized_options'
Is there a problem in my audio plugin or in the installation? I am using Ubuntu 14.04. I am a beginner, pardon if i have overlooked anything basic.
This happened to me on windows. I removed protobuf and libprotobuf and then reinstalled tensorboard, and it worked!
Not sure why, but while trying to find a solution like you it seemed like protobuf caused such issues in other libraries so I tried

Cannot run TensorFlow compiled with MKL

I've compiled the latest TensorFlow on Ubuntu 16.04 with CUDA and MKL like so
bazel build --config=opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --config=mkl --config=cuda //tensorflow/tools/pip_package:build_pip_package
And now when I'm trying to run it I'm getting an error saying that one of intel's libraries can't be found. I've also found other people who're installing a different DNN framework struggling with this https://github.com/PaddlePaddle/Paddle/issues/3213 and found an Intel doc https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation that basically says that these files should become avilable when you follow the directions in that doc as far as I understood this. I've followed those directions and everything seems to have worked, but in reality those libmklml_intel.so and libiomp5.so files weren't added to /usr/local/lib.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libmklml_intel.so: cannot open shared object file: No such file or directory
Edit:
actually, they were located in /mkl-dnn/external/mklml_lnx_2018.0.20170720/lib after I've cloned mkl-dnn git and followed directions in https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation
Actually, the libs were located in /mkl-dnn/external/mklml_lnx_2018.0.20170720/lib after I've cloned mkl-dnn git and followed directions in https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation
So I copied them into /usr/local/lib and included those folders in .bashrc as
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
and reloaded .bashrc
source ~/.bashrc
And now TensorFlow works.

ImportError: No module named six - Already Installed six

I've installed six with the command
pip install six
and if I print the version with:
python -c "import six; print (six.__version__)"
the version of six is listed as:
1.10.0
I'm trying to convert my Python program into stand-alone executable.
I've tried py2exe and PyInstaller. Both create the package fine but when I run the main.exe I get a brief flash with the following error:
Traceback (most recent call last):
File "main.py", line 9, in <module>
File "requests\__init__.pyc", line 58, in <module>
File "requests\utils.pyc", line 26, in <module>
File "requests\compat.pyc", line 7, in <module>
File "requests\packages\__init__.pyc", line 7, in <module>
File "urllib3\__init__.pyc", line 10, in <module>
File "urllib3\connectionpool.pyc", line 30, in <module>
File "urllib3\packages\six.pyc", line 5, in <module>
ImportError: No module named six
Can someone help me understand how to use this traceback to fix my issue?
I have tried to include six in my setup.py for p2exe:
from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["six"]}})
But alas it did not work.
pip install urllib3 --upgrade
solved the issue.
Found this here: https://stackoverflow.com/a/44071536/3804349

Python 2.7.9 PyBrain issue with SciPy

I just tried installing SciPy using scipy‑0.15.1‑cp27‑none‑win_amd64.whl
I have Python 2.7.9 x64 installed
I have wheel installed
I have numpy installed
I am working under Windows7
The log said that scipy has been successfully installed after running:
pip install scipy-0.15.1-cp27-none-win_amd64.whl
The log said that pybrain has been installed succeffully as well:
pip install pybrain
When I create a python file I can import scipy, but when I try to import pybrain I get:
Traceback (most recent call last): File
"C:\Users\me\Desktop\PROJECT\nn.py", line 1, in
import pybrain File "C:\Python27\lib\site-packages\pybrain__init__.py", line 1, in
from structure.init import * File "C:\Python27\lib\site-packages\pybrain\structure__init__.py", line 2,
in
from modules.init import * File "C:\Python27\lib\site-packages\pybrain\structure\modules__init__.py",
line 2, in
from gate import GateLayer, DoubleGateLayer, MultiplicationLayer, SwitchLayer File
"C:\Python27\lib\site-packages\pybrain\structure\modules\gate.py",
line 11, in
from pybrain.tools.functions import sigmoid, sigmoidPrime File "C:\Python27\lib\site-packages\pybrain\tools\functions.py", line 4, in
from scipy.linalg import inv, det, svd File "C:\Python27\lib\site-packages\scipy\linalg__init__.py", line 161, in
from .misc import * File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in
from . import blas File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in
from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.
trying to
import from scipy.linalg import _fblas
only gives the same error:
Traceback (most recent call last): File
"C:\Users\me\Desktop\PROJECT\nn.py", line 1, in
from scipy.linalg import _fblas File "C:\Python27\lib\site-packages\scipy\linalg__init__.py", line 161, in
from .misc import * File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in
from . import blas File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in
from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.
I reached a conclusion I am missing LAPACK so i build it using this link The build finished and all tests passed, but the issue is still there... maybe i did not copy the LIB and BIN to the right destination...
Uninstall and reinstall.
If you didn't install with sudo the first time, that may be the problem if you're installing for your global Python modules.
You can also try using installs from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy-stack

What should I modify to solve the "No module named _sqlite3" error message?

I installed ATpy-0.9.7 on my pc successfully and I also have the Python version of "2.7.5".
But when I import atpy I get the following error message:
>>> import atpy
ERROR: ImportError: No module named _sqlite3 [unknown]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "atpy/basetable.py", line 15, in <module>
from . import registry
File "atpy/registry.py", line 186, in <module>
from . import sqltable
File "atpy/sqltable.py", line 10, in <module>
from . import sqlhelper as sql
File "atpy/sqlhelper.py", line 11, in <module>
import sqlite3
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I also installed db_sqlite3.egg-info. I don't know why this error message occurs!
I installed again th python2.7.5 with the following command :
./configure --prefix=$PYTHONPATH
but I also get this error after executing make:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 bsddb185
dbm dl gdbm
imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
How could I run configure in order to install required C libraries?
If you are using a self built version of Python you need to ensure that both the base and the development sqllite3 packages are installed on your system before building Python.
If they are not and, as you said, you do not have superuser privileges, you can download and build sqlite locally, and get your Python build to use that version. This blog post describes how.
According to this question
How can I install sqlite3 to Python?
...you shouldn't have to install anything to get sqlite3 for python. Before I could import atpy I did have to install astropy (which was quite involved). After I did that, everything worked.