PySide Import Error on Ubuntu 12.04 - pyside

$python
Python 2.6.5 (r265:79063, Oct 1 2012, 22:04:36)
[GCC 4.4.3] on linux2
import PySide
PySide.version
'1.1.2'
import PySide.QtCore
Traceback (most recent call last):
File "", line 1, in
ImportError: libpyside-python2.6.so.1.1: cannot open shared object file: No such file or directory

Adding the following to .bashrc helped.
export LD_LIBRARY_PATH=/usr/local/lib/python2.6/dist-packages/PySide-1.1.2-py2.6.egg/PySide
It still didn't work in Eclipse; for that, I added LD_LIBRARY_PATH as an environment variable.

Related

Unable to imoprt modules on python script while running on cmd

I can not run python scripts on Command Prompt which has to import any module whereas I can run that script without any error on python IDLE. I think, this is happening after I install Anaconda on my machine.
Even if I run "Python" command it starts the shell and then there I can import any module that I want without any error.
C:\Users\USER>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>>
But when I try to run a script which has to import any module directly It rises a "ModuleNotFoundError" error.
E:\Python\PyQt4\Apps\test>main.py
Traceback (most recent call last):
File "E:\Python\PyQt4\Apps\test\main.py", line 9, in <module>
from PyQt4 import QtCore, QtGui
ModuleNotFoundError: No module named 'PyQt4'
E:\Python\PyQt4\Apps\test>
I don't know why it is happening

Tensorflow install on Windows with anaconda and no internet connection

I can not install Tensorflow on Windows because there in no internet connection based on commpany's security policy.
I just installed anaconda and python by transmiting files with intranet.
Please let me know how to install that with no internet connection.
==========================================================================
In addition, when I used the below command after installing tensorflow, I found
other problems..
Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Daisy\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\Daisy\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 63, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Daisy\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google'
I don't know how to solve this one.
If you can download the whl file and transfer it to your workstation, then you can run:
pip.exe install --upgrade --no-deps <tensorflow whl file name>
This should avoid trying to connect to download tensorflow dependencies, as anaconda already has most of these.

python 2.7 OSX 10.10 package problems

I'm using :
mac osx 10.10.1
Yesterday I started to get errors using same packages that I normally use.
After few hrs I decided to remove python from my mac
I installed python again following this instructions:
http://docs.python-guide.org/en/latest/starting/install/osx/#install-osx
(i a nut shell I installed python 2.7 using HomeBrew)
from the shell:
$python
Python 2.7.8 (default, Oct 19 2014, 16:02:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from the shell:
$ which python
/usr/local/bin/python
from the shell:
$ which -a python
/usr/local/bin/python
/usr/local/bin/python
I installed pip
I installed few pkgs using $ pip install command
when I try to just import openpyxl
I'm getting this:
import openpyxl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/openpyxl/__init__.py", line 27, in <module>
from openpyxl.workbook import Workbook
File "/usr/local/lib/python2.7/site-packages/openpyxl/workbook/__init__.py", line 25, in <module>
from .workbook import *
File "/usr/local/lib/python2.7/site-packages/openpyxl/workbook/workbook.py", line 11, in <module>
import threading
File
"/usr/local/Cellar/python/2.7.8_2/Frameworks/
Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 14, in <module>
from time import time as _time, sleep as _sleep
ImportError: cannot import name time
please can you help me out?
thanks
d
additional info:
meanwhile I tried to do same thing else to fix the problem
(I didn't fix it)
Basically I installed virtualenv
I created a basic virtual env
I have a new folder with python and all the pkgs
(venv_002)danielepemys-MacBook-Pro:my_python_virtualenv danielepemy$ which python
/Users/danielepemy/my_python_virtualenv/venv_002/bin/python
everything looks fine, python works, pip works the pkgs are listed in the virtual env
(venv_002)danielepemys-MacBook-Pro:my_python_virtualenv danielepemy$ pip list
pip (1.5.6)
setuptools (3.6)
wsgiref (0.1.2)
XlsxWriter (0.6.4)
when I run a simple test script with XlsxWriter I get:
python ..//internet_speed_test_002.py
Traceback (most recent call last):
File "..//internet_speed_test_002.py", line 28, in <module>
excel_file.close()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 286, in close
self._store_workbook()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 509, in _store_workbook
xml_files = packager._create_package()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/packager.py", line 142, in _create_package
self._write_core_file()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/packager.py", line 325, in _write_core_file
core._assemble_xml_file()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 57, in _assemble_xml_file
self._write_dcterms_created()
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 122, in _write_dcterms_created
date = self._localtime_to_iso8601_date(date)
File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 76, in _localtime_to_iso8601_date
return date.strftime("%Y-%m-%dT%H:%M:%SZ")
AttributeError: 'module' object has no attribute 'struct_time'
Do you have any files called time.py or time.pyc in your current directory? If so, rename or delete them (.pyc files can simply be deleted).

Correct way to install scikit-learn on OS-X using port

I'm tying to install scikit-learn using port on OS-X. Any idea what I'm missing here.
port version
Version: 2.1.3
OS-X
10.8.2 Build 12C60
Xcode
Version 3.2.5 (1760)
Python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
command to install scikit-learn
sudo port install py27-scikit-learn
---> Computing dependencies for py27-scikit-learn
---> Cleaning py27-scikit-learn
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
However, looks like it's not installed or configured properly. What am I missing here ?
>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sklearn
>>> from sklearn import cluster, covariance, manifold
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sklearn
>>>
I moved to Homebrew and everything after that was easy.

Unable to import argparse 1.2.1 for python 2.5 on windows

So, I thought that I had correctly installed the setuptools and argparse 1.2.1.
C:\Python25_64bit>python ez_setup.py argparse
Searching for argparse
Best match: argparse 1.2.1
Processing argparse-1.2.1-py2.5.egg
argparse 1.2.1 is already the active version in easy-install.pth
Using c:\python25_64bit\lib\site-packages\argparse-1.2.1-py2.5.egg
Processing dependencies for argparse
Finished processing dependencies for argparse
C:\Python25_64bit>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:19:34) [MSC v.1400 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named argparse
>>> quit()
However, it seems that I can't import it, as you can see above. I also tried directly adding the egg to my Eclipse PyDev projects, but this was to no avail, either. As you can see, nothing is set in my environment. Perhaps, this is the problem?
C:\Python25_64bit>echo %PYTHONPATH%
%PYTHONPATH%
C:\Python25_64bit>echo %PYTHONHOME%
%PYTHONHOME%
I hope you paid attention while installing and noted where argparse was installed.
In your script (run from the commandline or from your IDE) include at the top:
import sys
for p in sys.path:
print repr(p)
to see all the paths python is searching through. Either add the path to argparse using:
sys.path.insert(0, '/your/path/to/argparse')
or move the install to something in the path.
The environment variables can be empty, there are compiled in elements for sys.path as well.

Resources