I'm trying to use pyradiomics extension on slicer 3d. I have an issue that I think it's related to my python installation. I tried to reinstall pyradiomics with no results. This is the error I get
RadiomicsCLI standard error:
Traceback (most recent call last):
File "/Applications/Slicer.app/Contents/Extensions-26813/SlicerRadiomics/lib/Slicer-4.8/cli-modules/SlicerRadiomicsCLIScript", line 6, in <module>
from radiomics.scripts import commandline
File "/Applications/Slicer.app/Contents/Extensions-26813/SlicerRadiomics/lib/python2.7/site-packages/radiomics/__init__.py", line 4, in <module>
import collections # noqa: F401
File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/collections.py", line 20, in <module>
from _collections import deque, defaultdict
ImportError: No module named _collections
RadiomicsCLI completed with errors
anybody has an idea on how to solve this?
This was a build error and has since been fixed.
Related
I have made a few projects which run fine. A new project required me to install pip install cbpro (a module for dealing with coinbase cryptocurrency API).
After installing it, even running the simplest code throws several errors:
Input:
import cbpro
import pandas as pd
c = cbpro.PublicClient()
data = pd.DataFrame(c.get_products())
data.tail().T
Errors:
Traceback (most recent call last):
File "/Users/me/PycharmProjects/stonks/coinbase_interface.py", line 1, in <module>
import cbpro
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cbpro/__init__.py", line 1, in <module>
from cbpro.authenticated_client import AuthenticatedClient
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cbpro/authenticated_client.py", line 10, in <module>
import requests
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/__init__.py", line 63, in <module>
from . import utils
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 29, in <module>
from .cookies import RequestsCookieJar, cookiejar_from_dict
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/cookies.py", line 174, in <module>
class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
Secondly, when I then go to other projects that were working well, I get additional errors. Of note, those projects start with:
import pandas as pd
import requests
import json
Errors:
Traceback (most recent call last):
File "/Users/me/PycharmProjects/stonks/historical_crypto_pull.py", line 2, in <module>
import requests
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/__init__.py", line 63, in <module>
from . import utils
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 29, in <module>
from .cookies import RequestsCookieJar, cookiejar_from_dict
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/cookies.py", line 174, in <module>
class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
Things I've tried:
If I uninstall cbpro, then uninstall and reinstall requests, I can undo the error and am back where I started. However, I'm interested in knowing why I am encountering these errors because I'd like to actually use cbpro and know how to solve this issue in the future.
The libraries I was using were not compatible with Python 3.10. I am still at a loss for how I would inherently know that based on the errors thrown, but since then my solution was to install Python 3.9 and see if I still get the same errors when running 3.9.
(Then I also read that it might be a better idea for my current purposes to use a slightly older version of Python, so I moved over to 3.9 completely and haven't had the same issue again.)
I found several questions about the same issue here and here
from pyfinance.ols import PandasRollingOLS
I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pyfinance/utils.py", line 78, in <module>
from pandas.tseries.frequencies import FreqGroup, get_freq_code
ImportError: cannot import name 'FreqGroup' from 'pandas.tseries.frequencies' (/usr/local/lib/python3.8/site-packages/pandas/tseries/frequencies.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/pyfinance/__init__.py", line 32, in <module>
from .returns import TFrame, TSeries # noqa
File "/usr/local/lib/python3.8/site-packages/pyfinance/returns.py", line 42, in <module>
from pyfinance import ols, utils
File "/usr/local/lib/python3.8/site-packages/pyfinance/ols.py", line 15, in <module>
from pyfinance import utils
File "/usr/local/lib/python3.8/site-packages/pyfinance/utils.py", line 80, in <module>
from pandas._libs.tslibs.frequencies import FreqGroup, get_freq_code
ModuleNotFoundError: No module named 'pandas._libs.tslibs.frequencies'
I tried uninstalling and reinstalling pandas versions 1.1.3, 1.1.2, 1.1.1 and none of them work, I just get the same error, I then tried building pandas in the following fashion:
!python setup.py build_ext --inplace --force
And I still get the same error
Just for reference
I did some digging and it looks like pandas changed their api, which results in the error mentioned. I modified the source code and included the right imports which are in pyfinance/utils.py:
In line 77 changed from:
try:
from pandas.tseries.frequencies import FreqGroup, get_freq_code
except ImportError: # 0.24+, or somewhere around then
from pandas._libs.tslibs.frequencies import FreqGroup, get_freq_code
to
try:
from pandas.tseries.frequencies import FreqGroup, get_freq_code
except ImportError:
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.tests.tslibs.test_period_asfreq import get_freq_code
I created a pull request here if you're facing the same problem, you may clone and install my fork
Make sure you have the right version of pyfinance. Installing 0.1.3 solved my issue.
https://pypi.org/project/pyfinance/0.1.3/
In my Python script I need gssapi as authentication mechanism when applying requests package.
It came to my attention that package requests_gssapi seems promising for my purpose.
After "pip install requests_gssapi" and import it I got this:
>>> from requests_gssapi import HTTPSPNEGOAuth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\opt\Python36\lib\site-packages\requests_gssapi\__init__.py", line 17, in <module>
from .gssapi_ import HTTPSPNEGOAuth, REQUIRED, OPTIONAL, DISABLED # noqa
File "C:\opt\Python36\lib\site-packages\requests_gssapi\gssapi_.py", line 6, in <module>
import gssapi
File "C:\opt\Python36\lib\site-packages\gssapi\__init__.py", line 29, in <module>
from gssapi.raw.types import NameType, RequirementFlag, AddressType # noqa
File "C:\opt\Python36\lib\site-packages\gssapi\raw\__init__.py", line 50, in <module>
from gssapi.raw.creds import * # noqa
ImportError: DLL load failed: The specified module could not be found.
To me it seemed that extra package needs to be installed, but how?
Please help, thanks
I am programming in Python 3.3 on the latest version of Ubuntu. I am writing code for a project involving a library that works with Twitter. Here is the output from the terminal I have:
Traceback (most recent call last):
File "tryout.py", line 2, in <module>
import twitter
File "/home/owner/Documents/twitter/__init__.py", line 15, in <module>
from .stream import TwitterStream
File "/home/owner/Documents/twitter/stream.py", line 9, in <module>
from ssl import SSLError
File "/usr/local/lib/python3.3/ssl.py", line 60, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: No module named '_ssl'
I've been looking around to find a solution for the _ssl error but can't seem to find one that I could follow.
as from title, if I try to import ctypes in nuke6.1v2 I get this error:
import ctypes
# Result: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Nuke6.1v2\lib\ctypes\__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: No module named _ctypes
I also tryed to import it from the Python 2.6 main folder but with no luck.
However, if I try to import it in another package (softimage for example) I have no problem at all.
I have found a lot of people having the same problem, but none of the solutions worked for me.
Any idea?
Thanks