I'm trying to use PyOpenCL via SSH on Ubuntu, but when I get in the "prg = cl.Program(ctx, kernel).build()" it returns
`Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 141, in build
options = options + ["-I", _find_pyopencl_include_path()]
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 722, in _find_pyopencl_include_path
from pkg_resources import Requirement, resource_filename
ImportError: No module named pkg_resources`
The program I'm trying to build is the oficial from PyOpenCL documentation (https://documen.tician.de/pyopencl/index.html).
You just have to install the python-pkg-resources package, which provides the python package called "pkg_resources".
For other distributions, the setuptools for python package might be needed.
i had the same problem that u have mentioned above n the solution worked for me is that i have to update my setuptools
pip install --upgrade setuptools
n after doing that it works...
its also handy for some other packages.
Related
I am trying to convert the training text file to bin file for training the textsum of tensorflow. But I encountered the following error:
$ python textsum/data_convert_example.py --command text_to_binary --in_file data/tt.txt --out_file data/bin_data_train
Traceback (most recent call last):
File "textsum/data_convert_example.py", line 12, in <module>
import tensorflow as tf
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 104, in <module>
from tensorflow.python.platform import test
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/test.py", line 57, in <module>
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/usr/local/lib/python2.7/dist-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/usr/local/lib/python2.7/dist-packages/mock/mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 461, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 448, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 755, in get_version
name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name mock was given, but was not able to be found.
Kindly help me. I am using tensorflow 1.2.0 with python 2.7.2.
You must have a problem with your install.
Please try the following commands:
pip install --upgrade mock
pip install --upgrade distribute
If it does not work, you should give us more details about how you installed tensorflow (pip? conda? clone & setup.py?) and try to reinstall from scratch.
Hope it helps
I had the same issue (however not related to tensorflow) and in my case updating setuptools was the fix.
I've found the suggestion here:
https://github.com/testing-cabal/mock/issues/314
Before update I had setuptools 0.6c11 and I've updated to latest 39.2.0.
pip install --upgrade setuptools
or actually in my case I had to download and install locally since production server has no connection to internet:
pip download setuptools
pip install setuptools-39.2.0-py2.py3-none-any.whl
After an upgrade on my awscli install, I ran in this error. I can't figure out the reason for that error. Can anyone help?
AWS Cli Error:
Traceback (most recent call last):
File "/usr/bin/aws", line 23, in <module>
sys.exit(main())
File "/usr/bin/aws", line 19, in main
return awscli.clidriver.main()
File "/usr/share/awscli/awscli/clidriver.py", line 44, in main
driver = create_clidriver()
File "/usr/share/awscli/awscli/clidriver.py", line 53, in create_clidriver
event_hooks=emitter)
File "/usr/share/awscli/awscli/plugin.py", line 44, in load_plugins
modules = _import_plugins(plugin_mapping)
File "/usr/share/awscli/awscli/plugin.py", line 61, in _import_plugins
module = __import__(path, fromlist=[module])
File "/usr/share/awscli/awscli/handlers.py", line 24, in <module>
from awscli.customizations.ec2addcount import ec2_add_count
File "/usr/share/awscli/awscli/customizations/ec2addcount.py", line 16, in <module>
from botocore.parameters import StringParameter
ImportError: No module named 'botocore.parameters'
Any help will be apreciated!
Best regards
The subpackage botocore.parameters was split into serveral other modules with version 0.64.0 - but your version of awscli seems to rely on an older version as it expects this package to be present.
Depending on your way of installing awscli the problem might have different origins. When looking at the paths in the trace, it seems as if you've installed it with a package from your OS vendor. Instead of doing that you might drop those package and install it using pip.
pip install awscli
This will ensure the currently latest stable version of awscli to be installed. When you want to upgrade again in the future, run pip -U install awscli.
If you want to stick with the OS vendors version you probably want to reinstall awscli completely to fix this issue.
Another easier solution would be to use the awscli install bundle provided by amazon.
You can find all the instructions here:
https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html
The situation: I'm trying to install pyside on a project using the PyCharm IDE, however it says that it does not support python 3.5 that is installed by default on ubuntu 16.04. It does support python 2.7, however I'd rather not start a new project using python 2.
What I've done:
So I download python 3.45, extracted it, and I am successful in installing it to a directory using the following command:
`cd /path/to/extracted/python34
./configure --prefix=/path/to/install/dir
make
make install`
The next step is to create a virtualenv out of the newly installed python 3.4, so that it will have its own pip and other tools, so I run the following code:
cd /path/to/virtualenv/script
./virtualenv.py --python=/path/to/python34 /path/to/desired/virtualenv/dir
which fails, unfortunately
What went wrong:
I attempt to use the newly installed Python 3.4 to create a virtualenv, however I am met with errors when I do so. The result is the same whether I create the virtualenv using the builtin PyCharm tool, or even if I use a downloaded source of the virtualenv script. However, I was able to find out that the first error was about zlib, and I attempted to apply the solutions found here: building Python from source with zlib support
The zlib issue was resolved by logging in as administrator, and installing zlib1g-dev through:
sudo apt-get install zlib1g-dev
I also uncommented the following line from the Modules/Setup file of the extracted Python 3.4 source
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
But even with the zlib issue resolved, I am now met with the following error log when trying to create a virtualenv using the freshly installed python 3.4:
`
Installing setuptools, pip, wheel...
Complete output from command /home/work/Documents...gQtEnv/bin/python3.4 - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/wheel.py", line 39, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 14, in <module>
File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 66, in <module>
ImportError: cannot import name 'HTTPSHandler'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "./virtualenv.py", line 2327, in <module>
main()
File "./virtualenv.py", line 711, in main
symlink=options.symlink)
File "./virtualenv.py", line 944, in create_environment
download=download,
File "./virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "./virtualenv.py", line 795, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/work/Documents...gQtEnv/bin/python3.4 - setuptools pip wheel failed with error code 1`
What I'm trying to figure out:
And this is where I am now. I would like to create a virtualenv from a non-root and non-system installation of python that is built from source. I understand that I can fiddle around and do trial and error installation of what I would guess to be necessary packages until all the errors go away, however I am not keen on willy nilly installation, especially as root. I'm supposing that there must be a way to install python without root access, and create a virtual env using this. Maybe identify what the necessary packages are, download all of them, build them, and add them to my local user's system path? Unfortunately I only have a vague idea on how to do half of these. Any guidance will be appreciated.
Thanks to all those who have taken time to read this and have attempted to provide a solution. Hoping for a resolution to the issue.
Now we're developing our software on the customer side, and there is:
maestro#UIServer:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"
system is installed. We're not allowed to upgrade this system to a newer version, but we need to use Python 2.7 in our project.
E.g. we have to use pymorphy2 package, but when we're trying to import it into project, we get:
>>> import pymorphy2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/pymorphy2/__init__.py", line 3, in <module>
from .analyzer import MorphAnalyzer
File "/usr/local/lib/python2.7/site-packages/pymorphy2/analyzer.py", line 10, in <module>
from pymorphy2 import opencorpora_dict
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/__init__.py", line 4, in <module>
from .storage import load_dict as load
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/storage.py", line 24, in <module>
from pymorphy2.utils import json_write, json_read
File "/usr/local/lib/python2.7/site-packages/pymorphy2/utils.py", line 5, in <module>
import bz2
ImportError: No module named bz2
Ok, we're trying to install libbz2-dev:
sudo apt-get install libbz2-dev
end getting this:
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to avoid this problem?
Thanks in advance!
Download python, build and install using :
$ ./configure
$ make
$ make install
I am assuming you have build-essential installed or at least gcc. You can customize installation by passing prefix=/path/where/you/want/python/installed and other flags to make.
I tried to get atpy on python 2.7. I downloaded ATpy0.9.6 from
https://pypi.python.org/pypi/ATpy/0.9.6
then tar it, and run:
cd ATpy0.9.6
sudo python setup.py install
things seemed to work well.
But when I tried to import atpy on python, I got always this error message:
ImportError: No module named astropy.io
More precisely,
>>> import atpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 15, in <module>
from . import registry
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/registry.py", line 164, in <module>
from . import fitstable
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/fitstable.py", line 8, in <module>
from astropy.io import fits
ImportError: No module named astropy.io
>>>
Could anyone help me to figure out the problem?
Perhaps the 'atpy' package depends on another package called 'astropy.io' that you are missing? Yes here it is https://astropy.readthedocs.org/en/v0.1/index.html
It happens that downloading the tar balls from pypi.python.org is the wrong way to install Python packages. The right way (though the Python docs explain poorly), is to run a command like
pip install atpy
This command will install your package and all its dependencies.
If the command pip is missing, you have to install it, which is ironically really complicated.
In my case the solution was to install astropy
pip install --no-deps astropy