Installing pymongo on a nitrous.io box - python

I'm fairly new to Python, and Nitrous.IO, and MongoDB, and command line in general so would appreciate a little guidance here if possible.
I'm trying to install pymongo on my Nitrous.IO box but can't seem to find a way to do it - this tutorial suggests 'import pymongo' but that didn't work (see below).
I can't seem to find any tutorials or help on this - a google search for "install +pymongo with nitrous.io" gave me 0 results.
action#thirdyearproject-148753:~(master*)$ import pymongo
import: unable to open X server `' # error/import.c/ImportImageCommand/366.
action#thirdyearproject-148753:~(master*)$ pip install pymongo
Traceback (most recent call last):
File "/home/action/.parts/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2431, in load_entry_point
return ep.load()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2147, in load
['__name__'])
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/__init__.py", line 10, in <modul
from pip.util import get_installed_distributions, get_prog
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 15, in <module>
from pip.locations import site_packages, running_under_virtualenv, virtualenv_no_global
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/locations.py", line 96, in <modu
build_prefix = _get_build_prefix()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/locations.py", line 64, in _get_
path = os.path.join(tempfile.gettempdir(), 'pip_build_%s' %
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/tempfile.py", line 269, in gettempdir
tempdir = _get_default_tempdir()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/tempfile.py", line 212, in _get_default_tempdir
("No usable temporary directory found in %s" % dirlist))
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/home/action']
action#thirdyearproject-148753:~(master*)$ easy_install pymongo
Traceback (most recent call last):
File "/home/action/.parts/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2829, in <module>
working_set = WorkingSet._build_master()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: setuptools==2.2
action#thirdyearproject-148753:~(master*)$ parts install pymongo
parts: ERROR: Package "pymongo" not found
Aborting!
Does anyone know how I would go about installing this? It's starting to be a real pain!

You might be able to install it withpip using this advice. Once you've done that, you would use the import pymongo at the top of your code file.

Related

Conda crashes after installing one package - OSError: /lib64/liblzma.so.5: version `XZ_5.2' not found

I used coda for a long time, with limited problems.
However, I recently installed Miniconda2 (Miniconda2-latest-Linux-x86_64.sh) on a HPC node.
Everything works fine, but I can not install multiple packages.
What happens, is that I install one package, and after that, I get the following error when I try to install a new one:
Traceback (most recent call last):
File "/hpc-home/ro/miniconda2/bin/conda", line 13, in <module>
sys.exit(main())
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1335, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1046, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1090, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1101, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1171, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/conda_package_handling/api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/entry.py", line 6, in <module>
from . import ffi
File "/hpc-home/ro/miniconda2/lib/python2.7/site-packages/libarchive/ffi.py", line 27, in <module>
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
File "/hpc-home/ro/miniconda2/lib/python2.7/ctypes/__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "/hpc-home/ro/miniconda2/lib/python2.7/ctypes/__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib64/liblzma.so.5: version `XZ_5.2' not found (required by /hpc-home/ro/miniconda2/lib/libarchive.so.13)
The problem is temporally fixed when I re-install conda:
bash Miniconda2-latest-Linux-x86_64.sh -u
I am not sure what I am missing here. Would someone point me towards a potential solution not involving using sudo, as I have no rights?

Creating a new virtualenv gives a permissions error

I'm getting the following output when running virtualenv newvenv.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 700, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in activate
self.insert_on(path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2334, in insert_on
self.check_version_conflict()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2373, in check_version_conflict
for modname in self._get_metadata('top_level.txt'):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2221, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1209, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1201, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1316, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/stevedore-1.5.0.egg-info/top_level.txt'
I haven't made virtualenvs in a while, but the last time I did, there was no permissions issue. virtualenv is up-to-date. While I could go messing around with permissions in the specified file in the trace, I'd rather not. Has anyone else run into similar issues with virtualenv, and if so, how did you solve them?
EDIT
The error comes up when trying to make the virtualenv in ~/venvs (Ubuntu 12.04), the same place as before the problem starting occurring, so there's no mounting problem.

pip install error: cannot import name 'unpack_url'

I'm using Python 3.4.1 64-bit on a Windows 8.1 machine. Pip has been giving me problems lately, specifically this error:
C:\Users\Charlie\Desktop>pip install wxPython_Phoenix-3.0.3.dev78341-cp34-none-w
in_amd64.whl
Traceback (most recent call last):
File "C:\Python34\Scripts\pip-script.py", line 9, in <module>
load_entry_point('Scipy-stack==14.8.27', 'console_scripts', 'pip')()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 519, in l
oad_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2630, in
load_entry_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2310, in
load
return self.resolve()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2316, in
resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python34\lib\site-packages\pip\__init__.py", line 13, in <module>
from pip.commands import commands, get_summaries, get_similar_commands
File "C:\Python34\lib\site-packages\pip\commands\__init__.py", line 6, in <mod
ule>
from pip.commands.bundle import BundleCommand
File "C:\Python34\lib\site-packages\pip\commands\bundle.py", line 6, in <modul
e>
from pip.commands.install import InstallCommand
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 5, in <modu
le>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "C:\Python34\lib\site-packages\pip\req\__init__.py", line 4, in <module>
from .req_set import RequirementSet, Requirements
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 9, in <module>
from pip.download import (url_to_path, unpack_url)
ImportError: cannot import name 'unpack_url'
This occurs every time I try to install any package. Has anyone had this problem before?
I used: easy_install -U pip
problem solved
Well, obviously there is an error with pip and unpack_url is probably use to download packages from PyPi. I suggest reinstalling by executing this script.

Failed install after installing Myysql-python

Problem using MySQLdb after installing MySQLdb-python. I followed the instructions I followed the instruction that had me delete the build and delete the egg then modify the my_config and then run the install again. I also tried installing the 64 bit version still no luck
Traceback (most recent call last):
File "/Users/nick.leclair/Documents/Aptana Studio 3 Workspace/Tester/driveByScript.py", line 1, in <module>
import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 4, in __bootstrap__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 882, in resource_filenameself, resource_name
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1351, in get_resource_filename self._extract_resource(manager,self._eager_to_zip(name))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1382, in _extract_resource outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2576, in _mkstemp
from tempfile import mkstemp
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
ImportError: cannot import name Random
Problem solved, it was problem with Aptana not picking up the new library.

vtk python can't be detected

VTK was working fine until I updated it. I made sure to turn on all the python linking etc.
Now, when I run mayavi2, I receive:
dustin#dustin:~$ mayavi2
Traceback (most recent call last):
File "/usr/local/bin/mayavi2", line 9, in <module>
load_entry_point('mayavi==4.3.0', 'console_scripts', 'mayavi2')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 343, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 2309, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 2015, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/mayavi/scripts/mayavi2.py", line 457, in <module>
raise ImportError(msg)
ImportError: libvtkCommonPythonD.so.5.10: cannot open shared object file: No such file or directory
________________________________________________________________________________
Do you have vtk installed properly?
How can I fix this?
I found the file libvtkCommonPythonD.so.5.10 and added it to added to LD Library Path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/vtk-5.10

Categories

Resources