Python trouble with nose - python

I am having some trouble with LPTHW on Exercise 46 in which we create a skeleton directory for a future project and install pip among other things. I have having a problem with nosetests. Whenever I run it I get a problem. I have everything set up as he wants me to.
Here is the problem (I am running Ubuntu 12.04)
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 9, in <module>
load_entry_point('nose==1.3.0', 'console_scripts', 'nosetests')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2279, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/nose/__init__.py", line 1, in <module>
from nose.core import collector, main, run, run_exit, runmodule
File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 11, in <module>
from nose.config import Config, all_config_files
File "/usr/local/lib/python2.7/dist-packages/nose/config.py", line 9, in <module>
from nose.plugins.manager import NoPlugins
File "/usr/local/lib/python2.7/dist-packages/nose/plugins/__init__.py", line 184, in <module>
from nose.plugins.base import Plugin
EOFError: EOF read where object expected

I figured it out. When I installed Nose the first time, I didn't 'sudo' it and it never installed. And I cicked out of terminal before I saw it. At least. that's what I thought happened. I deleted nose and reinstalled it and now it works.

Suddenly get the same error. I fix this by removing --with-id from the argument.
I used it previously.
It works now.

Related

Problem using `flake8` for linting on Sublime Text 3

I've been unsuccessfully trying to use the SublimeLinter-flake8 on my Xubuntu laptop. I have Python 3.7.7 installed through the Anaconda distribution, as well as the flake8 package. I'm also using the Anaconda IDE plugin for Sublime Text 3, with Anaconda's linting turned off.
But I keep getting the same error message whenever I type some Python code in:
SublimeLinter: #1 flake8 <untitled 25> ERROR:
=============================================
Traceback (most recent call last):
File "/home/srdjan/anaconda3/bin/flake8", line 11, in <module>
load_entry_point('flake8==3.7.7', 'console_scripts', 'flake8')()
File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2714, in load_entry_point
return ep.load()
File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2332, in load
return self.resolve()
File "/home/srdjan/.local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2338, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/srdjan/anaconda3/lib/python3.7/site-packages/flake8/main/cli.py", line 2, in <module>
from typing import List, Optional
File "/home/srdjan/anaconda3/lib/python3.7/site-packages/typing.py", line 1347, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/home/srdjan/anaconda3/lib/python3.7/site-packages/typing.py", line 1003, in __new__
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry
Strangely enough, I was having somewhat similar problems when I was using SublimeLinter-pycodestyle and SublimeLinter-pyflakes, where pyflakes would keep throwing these weird error messages. I was never able to get it to work.
Should I perhaps uninstall pycodestyle and pyflakes from my laptop, now that I have flake8 and its accompanying SublimeLinter-flake8 plugin?

Raspberry Pi - Errors downloading Python Modules

I am trying to download a module for python on my raspberry pi 3. The first error I received was saying my urllib3 was not up to date. This error was given whenever I ran the pip command. So I re-installed urllib3, and it downloaded the same version I had, even though I had just ran sudo apt-get update. I then decided to remove pip, and re-install, and that didn't fix it. The final thing I have tried doing it manually downloading urllib3 from github, and then installing it onto my pi using setup.py. This was successful in eliminating the previous error, but I am now receiving this.
$ pip install imutils
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module>
major, minor, patch = urllib3_version
ValueError: need more than 1 value to unpack
I would really appreciate any help, thanks.

"sre_constants.error: nothing to repeat" error every time trying to install using pip

I just installed Python 2.7.5 on my Windows 10 machine and I also got pip installed through setuptools. However whenever I try to install something using pip e.g. pip install numpy, I get this error message:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 8, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 73, in <module>
__import__('pip._vendor.packaging.specifiers')
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 275, in <module>
class Specifier(_IndividualSpecifier):
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 373, in Specifier
r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
File "C:\Python27\Lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "C:\Python27\Lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Since I'm pretty new to Python, I don't really understand what this error means. Any workaround?
I had a similar issue with a library that is using regular expressions (with the re.compile() function). I solved this issue installing the last version available 2.7.13 (I run a Windows 7).
Before I had the 2.7.6 version. I updated it installing the new version with the .msi installer, available in the Python web page.

packaging biom for FreeBSD

I'm working on packaging biom (2.1.5) for FreeBSD.
Based on the documentation, I initially had it depending on pynumpy and h5py, but digging I think it should also depend on:
py27-click-6.6
py27-future-0.14.3
py27-pyqi-0.2.0
py27-scipy-0.16.1.
Now I'm at the point where running biom gives the errors below. Do you have
suggestions for debugging? I'm not a python developer, so please be gentle.
Traceback (most recent call last):
File "/usr/local/bin/biom", line 9, in <module>
load_entry_point('biom-format==2.1.5', 'console_scripts', 'biom')()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 547, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2380, in load
return self.resolve()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2386, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/site-packages/biom/__init__.py", line 51, in <module>
from .table import Table
File "/usr/local/lib/python2.7/site-packages/biom/table.py", line 188, in <module>
from future.utils import string_types
ImportError: cannot import name string_types
In future 0.14.3, there is no string_types in future.utils. (Although it is mentioned in the documentation). Look at the 0.14.x branch of the github repo for future.
At the time of writing the current version of the future module is 0.15.2. So that port needs to be updated before biom will work. I'd suggest to contact the maintainer of that port.

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.

Categories

Resources