rpy2.tests, no item called "None" on the search list - python

I am using Rpy2 and running the tests using $python -m "rpy2.tests". I got the following errors. I am using ubuntu 14.03, python 2.7 and trying to calling R in python using this package.
rpy2 version: 2.6.0
- built against R version: 3-2.1--68531
- running linked to R version: R version 3.2.1 (2015-06-18)
....../tmp/tmpRWL4lU.py:17: UserWarning:
ri.baseenv['eval'](ri.parse(rcode))
..................................................................................................................................................................................x.........................................................................................................E
Stderr:
/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py:80: UserWarning: Error in as.environment(where) : no item called "None" on the search list
StrSexpVector((cls_packagename, )))
E...................................sssssssss................................E.s...s..s.....
======================================================================
ERROR: testRS4Auto_Type (robjects.tests.testMethods.MethodsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/tests/testMethods.py", line 115, in testRS4Auto_Type
robjects.methods.RS4)):
File "/usr/lib/python2.7/dist-packages/six.py", line 617, in with_metaclass
return meta("NewBase", bases, {})
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py", line 154, in __new__
cls_def = getclassdef(cls_rname, cls_rpackagename)
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py", line 80, in getclassdef
StrSexpVector((cls_packagename, )))
RRuntimeError: Error in as.environment(where) : no item called "None" on the search list
Stderr:
/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py:80: UserWarning: Error in as.environment(where) : no item called "None" on the search list
StrSexpVector((cls_packagename, )))
======================================================================
ERROR: testRS4Auto_Type_nopackname (robjects.tests.testMethods.MethodsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/tests/testMethods.py", line 122, in testRS4Auto_Type_nopackname
robjects.methods.RS4)):
File "/usr/lib/python2.7/dist-packages/six.py", line 617, in with_metaclass
return meta("NewBase", bases, {})
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py", line 154, in __new__
cls_def = getclassdef(cls_rname, cls_rpackagename)
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/robjects/methods.py", line 80, in getclassdef
StrSexpVector((cls_packagename, )))
RRuntimeError: Error in as.environment(where) : no item called "None" on the search list
======================================================================
ERROR: test_Rconverter (ipython.tests.test_rmagic.TestRmagic)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rpy2-2.6.0-py2.7-linux-x86_64.egg/rpy2/ipython/tests/test_rmagic.py", line 127, in test_Rconverter
tuple(fromr_dataf_np.ix[col_i].values))
File "/usr/lib/python2.7/dist-packages/numpy/core/records.py", line 418, in __getattribute__
raise AttributeError("record array has no attribute %s" % attr)
AttributeError: record array has no attribute ix
----------------------------------------------------------------------
Ran 383 tests in 3.719s
FAILED (errors=3, skipped=12, expected failures=1)
Any ideas to fix these three errors?
Thanks,

Related

ChannelAttribution built-in function “markov_model_local_api” not working on sample codes

I am working on a channels attribution project in Python. I use the python library "ChannelAttribution". When I followed the instruction from the official documentation and tried to use the built-in function "markov_model_local_api", it kept throwing an error. Then I tried to run the sample codes from https://channelattribution.io/pdf/ChannelAttributionWhitePaper.pdf:
from ChannelAttribution import *
#Download data
Data = pd.read_csv("https://channelattribution.io/csv/Data.csv",sep=";")
#Generate token
generate_token(email="my_email", job="my_job", company="my_institution")
token = 'my_token'
#Train
res=markov_model_local_api(token, Data, var_path="path", var_conv="total_conversions",var_value="total_conversion_value", var_null="total_null", order=1, sep=">")
It throws these errors below:
Exception ignored in: <function Connection.__del__ at 0x7fba45595670>
Traceback (most recent call last):
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 1013, in __del__
self.close()
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 784, in close
if self._sftp_live:
AttributeError: 'Connection' object has no attribute '_sftp_live'
Traceback (most recent call last):
File "src/cypack/ChannelAttribution.pyx", line 1188, in ChannelAttribution.markov_model_local_api
File "src/cypack/ChannelAttribution.pyx", line 894, in ChannelAttribution.__f_initialize_connection
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 132, in __init__
self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 71, in get_hostkey
raise SSHException("No hostkey for host %s found." % host)
SSHException: No hostkey for host 13.58.174.83 found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/li/Downloads/untitled0.py", line 18, in <module>
res=markov_model_local_api(token, Data, var_path="path", var_conv="total_conversions", var_value="total_conversion_value", var_null="total_null", order=1, sep=">")
File "src/cypack/ChannelAttribution.pyx", line 1248, in ChannelAttribution.markov_model_local_api
UnboundLocalError: local variable 'filename' referenced before assignment
How can I fix all errors and exceptions?

RecursionError: maximum recursion depth exceeded in comparison with djongo.exceptions.SQLDecodeError:

I am trying to make an app with django using djongo and mongodb. The connectivity for tables with no foreign key is working fine but where there is a Foreign Key involved, it is throwing this error. I will be greatful if anyone could help. I am getting this error.
Traceback (most recent call last):
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\djongo\sql2mongo\query.py", line 808, in iter
yield from iter(self._query)
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\sqlparse\tokens.py", line 19, in contains
return item is not None and (self is item or item[:len(self)] == self)
RecursionError: maximum recursion depth exceeded in comparison
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\djongo\cursor.py", line 76, in fetchone
return self.result.next()
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\djongo\sql2mongo\query.py", line 797, in next
result = next(self._result_generator)
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\djongo\sql2mongo\query.py", line 830, in iter
raise exe from e
djongo.exceptions.SQLDecodeError:
Keyword: FAILED SQL: SELECT %(0)s AS "a" FROM "accounts_account" WHERE "accounts_account"."id" = %(1)s LIMIT 1
Params: (1, 1)
Version: 1.3.6
Sub SQL: None
FAILED SQL: None
Params: None
Version: None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\django\db\utils.py", line 98, in inner
return func(*args, **kwargs)
File "C:\Users\theri\Desktop\Python_Amygo\amygo_python\venv\lib\site-packages\djongo\cursor.py", line 81, in fetchone
raise db_exe from e
djongo.database.DatabaseError
I am using the following versions:
django-4.1 , djongo-1.3.6 , pymongo-4.2.0 , sqlparse-0.2.4
I had this same issue Downgrading django from 4.1 to 3.2 worked for me.
pip install django==3.2

sphinx search AssertionError error in Python

I am trying ro run sphinx search with python but getting error
I try this code
python3
import sphinxapi
client = sphinxapi.SphinxClient()
client.SetServer('127.0.0.1',9312)
client.Query("english","language_index")
get an error
client.Query("english","language_index")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/sphinxapi/__init__.py", line 579, in Query
assert (len(self._reqs) == 0)
AssertionError

Gensim - AttributeError: Can't get attribute 'FixedCorpusWeight'

I've just installed Gensim and have run a test. 484 tests run successfully however I hit an error:
======================================================================
ERROR: testAddMorphemesToEmbeddings (gensim.test.test_varembed_wrapper.TestVarembed)
Test add morphemes to Embeddings
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/franciskim/Downloads/gensim-2.0.0/gensim/test/test_varembed_wrapper.py", line 56, in testAddMorphemesToEmbeddings
vectors=varembed_model_vector_file, morfessor_model=varembed_model_morfessor_file)
File "/Users/franciskim/Downloads/gensim-2.0.0/gensim/models/wrappers/varembed.py", line 69, in load_varembed_format
morfessor_model = morfessor.MorfessorIO().read_binary_model_file(morfessor_model)
File "/Users/franciskim/anaconda/lib/python3.6/site-packages/morfessor/io.py", line 179, in read_binary_model_file
model = pickle.load(fobj)
AttributeError: Can't get attribute 'FixedCorpusWeight' on <module 'morfessor.baseline' from '/Users/franciskim/anaconda/lib/python3.6/site-packages/morfessor/baseline.py'>
----------------------------------------------------------------------
I can only find 1 other instance of this happening on the internet, but there are no answers to this yet.

Python 2.7.10 64bit on Win10 - lib/test hangup

I am new to python. And I need to run getmail. After lots of error msgs I reduced my claim to run the tests under lib/test first:
python .\test\regrtest.py -v -M 2.0Gb -uall,-bsddb,-largefile
I am getting failure msgs from some of them but at:
test test_re failed -- Traceback (most recent call last):
File "F:\python27_64\lib\test\test_support.py", line 1287, in wrapper
return f(self, maxsize)
File "F:\python27_64\lib\test\test_re.py", line 973, in test_large_search
s = 'a' * size
OverflowError: cannot fit 'long' into an index-sized integer
Warning -- files was modified by test_sax
test test_shutil failed -- Traceback (most recent call last):
File "F:\python27_64\lib\test\test_shutil.py", line 138, in test_rmtree_dont_delete_file
handle, path = tempfile.mkstemp()
File "F:\python27_64\lib\tempfile.py", line 314, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "F:\python27_64\lib\tempfile.py", line 245, in _mkstemp_inner
_set_cloexec(fd)
File "F:\python27_64\lib\tempfile.py", line 50, in _set_cloexec
flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
AttributeError: 'module' object has no attribute 'F_GETFD'
python is hangup :-(
ALL ideas are welcome

Categories