Ckan install module missing error - python

I am attempting to install ckan on my system and I'm following the install from package directions (http://docs.ckan.org/en/latest/maintaining/installing/install-from-package.html). All the dependencies were installed correctly and the ckan package itself downloaded without error. When I went to run the install I got a module missing error for what to me looks like a trivial python module that should be there.
jeremy#jeremy-HP-ProBook-4530s:~$ sudo dpkg -i python-ckan_2.5-trusty_amd64.deb
[sudo] password for jeremy:
(Reading database ... 214293 files and directories currently installed.)
Preparing to unpack python-ckan_2.5-trusty_amd64.deb ...
Unpacking python-ckan (2.5.1-trusty1) over (2.5.1-trusty1) ...
Setting up python-ckan (2.5.1-trusty1) ...
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 7, in <module>
from paste.script.command import run
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 3, in <module>
import pkg_resources
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 36, in <module>
import plistlib
File "/usr/lib/python2.7/plistlib.py", line 62, in <module>
import datetime
ImportError: No module named datetime
/var/lib/dpkg/info/python-ckan.postinst: line 18: initctl: command not found
Site datapusher already enabled
I've confirmed that datetime is installed with a quick python -c 'import datetime' run. At this point I have done a little bit of digging and haven't been able to find anywhere else where this is duplicated nor exactly how to resolve this. Any help or advice is greatly appreciated.

Looking around for the error from plistlib it looks like the same error affecting https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1368144
Unfortunately I'm not sure how this would have come about. I'll continue digging and see if I can find out more, but it isn't anything I've seen before but it definitely appears virtualenv related.

Related

I cannot import libraries into python despite repeatedly installing them

I am struggling to install and import python libraries into my programs. originally I was using pydev but I kept getting messages like:
Traceback (most recent call last): File "C:\Users\satur\eclipse-workspace\DMD experimental\Main.py", line 11, in <module> from matplotlib import pyplot as plot ModuleNotFoundError: No module named 'matplotlib'
I installed matplotlib using py -m pip install matplotlib which produced a few messages like this.
WARNING: The script f2py.exe is installed in 'C:\Users\satur\AppData\Local\Programs\Python\Python310\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts fonttools.exe, pyftmerge.exe, pyftsubset.exe and ttx.exe are installed in 'C:\Users\satur\AppData \Local\Programs\Python\Python310\Scripts' which is not on PATH.
I was unsure what this meant so I tried running my program again and got the module not found error again.
being unable to resolve the issue I moved over to spyder because it came with many of the libraries I wanted thus avoiding the issue. however, as soon as I tried to import and install libraries not included with spyder I encountered the module not found error and a similar warning about the path. I added the paths mentioned in the warning to the PATH in spyder now when I run my code get this error message:
runfile('C:/Users/satur/.spyder-py3/proper orthogonal decomposition/dynamic mode decomposition experimental driver.py', wdir='C:/Users/satur/.spyder-py3/proper orthogonal decomposition')
Traceback (most recent call last):
File "C:\Users\satur\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\py3compat.py", line 356, in compat_exec
exec(code, globals, locals)
File "c:\users\satur\.spyder-py3\proper orthogonal decomposition\dynamic mode decomposition experimental driver.py", line 13, in <module>
import mat73
File "C:\Users\satur\AppData\Local\Programs\Python\Python310\Lib\site-packages\mat73\__init__.py", line 11, in <module>
import h5py
File "C:\Users\satur\AppData\Local\Programs\Python\Python310\Lib\site-packages\h5py\__init__.py", line 25, in <module>
from . import _errors
ImportError: cannot import name '_errors' from partially initialized module 'h5py' (most likely due to a circular import) (C:\Users\satur\AppData\Local\Programs\Python\Python310\Lib\site-packages\h5py\__init__.py)
I did some looking around and found this
https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#installing-packages-into-the-same-environment-as-spyder
I followed what instructions I understood
import sys; sys.executable
Out[50]: 'C:\\Users\\satur\\AppData\\Local\\Programs\\Spyder\\Python\\python.exe'
which is different from what I get when I run it in command prompt or in the pydev terminal both of which give me
C:\Users\satur\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe
when i go to C:\Users\satur\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\ I see: 3 versions of idel, 3 versions of pip, and 6 versions of python.
I am deeply confused. I want to install and import libraries into my python programs. I want to be able to run my programs in either (or for that matter any) ide. I seem to be hitting the very similar issues in both. every tutorial I have found online describes the steps to take to do this but not what they are or why I am doing them none of them seem to work and the more times I try to install things the more confused I get.
could someone please explain: how to install and import libraries into a python program. what python is doing when I install things and try to import them. and why both IDEs have similar but different errors.

Importing wxPython pops errors

Currently I am using Python 3.7, and Ubuntu 18.04. I downloaded wxPython from pip, but when I tried to import wx in my terminal, I get this error:
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleejandrof/anaconda3/lib/python3.7/site-packages/wx/__init__.py", line 17, in <module>
later on, when I tried other ways like and "._core import" I received an error like this:
ImportError: /home/aleejandrof/anaconda3/bin/../lib/libpangoft2-1.0.so.0: undefined symbol: pango_font_description_set_variations
After reading some posts here, I tried deleting the wx.py and wx.pyc files, which didn't work. The same happened when I read that downloading the main excecutable file would make the import occur with no errors, but it popped the same errors.
AttributeError: module 'wx' has no attribute '__version__'
I am trying to run a GUI pipeline, which works with wxPython. I'm thankful in advance, if any of you has suggestions.
When I made an environment of ubuntu18.04 using docker, ran into the same problem.
I had multiple libpangoft2-1.0.so.0 files.
It seemed the problem was /opt/conda/lib/libpangoft2-1.0.so.0 was looked up.
To change the name of the file solved the problem.
find / -name libpangoft2-1.0.so.0
/opt/conda/lib/libpangoft2-1.0.so.0
/opt/conda/pkgs/pango-1.42.4-h049681c_0/lib/libpangoft2-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
mv /opt/conda/lib/libpangoft2-1.0.so.0 /opt/conda/lib/libpangoft2-1.0.so.0-void
You may want to try:
conda install -c asmeurer pango

Missing Python Packaging Tools on Python Interpreter - Django

I've been working on a basic Django project and I deployed it to AWS Elastic Beanstalk. I'm not sure if that's causing this, but I'm just telling you this so that you know what I might have been done with my project. Then, my python project interpreter got kinda messy and when I try to run the application it started to give me some errors about missing packages. After that, I checked my project interpreter, and it was like this:
Then, I tried to install the required packages using PyCharm, however, it kept giving me the error below. I also tried to build some of those packages manually, like Django, on my own terminal but the error was same. Further, I was able to install packages on other python versions on my mac, which sorta tells I might have messed my default python interpreter somehow.
40:357: execution error: Traceback (most recent call last): File
"/var/folders/f1/k7c234sx5fn9j84yt130_znr0000gn/T/tmp2zDEZTpycharm-management/pip-9.0.1/setup.py",
line 6, in
from setuptools import setup, find_packages File "/Users/bkaankuguoglu/Library/Python/2.7/lib/python/site-packages/setuptools/init.py",
line 12, in
import setuptools.version File "/Users/bkaankuguoglu/Library/Python/2.7/lib/python/site-packages/setuptools/version.py",
line 1, in
import pkg_resources File "/Users/bkaankuguoglu/Library/Python/2.7/lib/python/site-packages/pkg_resources/init.py",
line 72, in
import packaging.requirements File "/Users/bkaankuguoglu/Library/Python/2.7/lib/python/site-packages/packaging/requirements.py",
line 59, in
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") TypeError: call() takes exactly 2 arguments (1 given) (1)
I'd really appreciate any help here and please ask me if any extra detail is needed to answer this question before downvoting.
pip install setuptools==33.1.1

No module named 'json' after installing simplejson

I am working in Ubuntu 14.04 and I have multiple versions of Python on my machine (they include python2.7 and python3.4). Few days back, I installed simplejson on my system. I don't remember how I did that but I guess it must be similar to pip install simplejson. However, now a strange problem has started appearing when I try installing any python package. For example, just now I tried installing Tkinter using sudo pip3.4 install Tkinter and it throws the following error:
Traceback (most recent call last):
File "/usr/local/bin/pip3.4", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip3.4')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 351, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2363, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 61, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/subversion.py", line 4, in <module>
from pip.index import Link
File "/usr/lib/python3/dist-packages/pip/index.py", line 15, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 25, in <module>
from distlib.scripts import ScriptMaker
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/scripts.py", line 15, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/resources.py", line 20, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/util.py", line 11, in <module>
ImportError: No module named 'json'
Sometimes I can fix this if the error tells me that in one of the files I have:
import json
which I simply convert to
import simplejson as json
I tried uninstalling simplejson:
sudo pip uninstall simplejson
but it gives me the same error: json not found.
Can anybody please help me fix this so that I would happily be able to install python packages? Thanks in advance.
Note: I do not have a definitive answer but will offer a series of steps you can try:
The first thing is see if you can import json from the usual python interpreter:
import json
print(json.__file__) #this would be important to know if it works
If that does work (as well as commenting what json.__file__ is) you would then want to try to use pip from the interpreter.
If you can't import json normally:
This is not surprising, I did not expect pip to be looking in a non-standard place for modules. You will want to figure out where the json package should be located on your computer, you can do this by importing another module from the standard library and looking at it's __file__:
>>> import fractions
>>> fractions.__file__
'/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/fractions.py'
This will obviously be different for you but I'd expect there to be a json folder in the same folder as fractions.py
if you can't import fractions or queue or datetime etc.
If you can't import anything from the standard library you will probably want to just reinstall python.
If the json folder is there and contains an __init__.py
Use the rename function of your file browser to make sure there are no weird special characters, but other then that I'm not sure, if you can import fractions.py but not a package from the same folder that would imply there is something very wrong with the import mechanics of your python version.
If the json folder is not with the rest of the standard library
It is possible that your python distribution has a different structure then I'd expect, it at least can't hurt to take a look for it.
You can search for the json folder amongst your various python files using the find command, not really sure how it works but just another thing to try. If you do find it with the __init__.py, encode.py, decode.py, scanner.py, and tool.py (at least those are the ones in my version) you'll probably want to figure out how it got there, but maybe just move it to the same folder as the rest of the standard library.
If you can't find the json package or you find it and it is corrupted
Well then you will need to replace it! Don't worry, this isn't too hard, just grab a source release of python from the site and extract the json package from it, once it is uncompressed the json folder should be in the Lib folder. Simply copy/move it to the rest of the standard library and you should be good to go!
I hope this helps you debug what is going on, This covers all the scenarios I could imagine happening and I would be interested in which one fixed your issue (or what you were able to figure out so I can come up with more options)
I am guessing that you install it using either pip install simplejson to download from PyPI or using apt-get install python-simplejson to download from ubuntu repositories.
It is possible that you downlaoded the library for the Python2 if you used any of the commands above and it won't be available for Python3 (which pip3.4 will use). Can you try these commands and help debug yourself?
$ python -c "import simplejson"
$ python3.4 -c "import simplejson"
This would tell you which version of the python did you install simplejson for last time (my guess in python2). If the 2nd command errors out with ImportError try:
$ pip3.4 install simplejson
and then install your libraries.

python using easy_install ImportError: No module named _md5

I searched a lot and did not find any answer to this problem =(
I have a CentOS 5 as a server, following this How To:
http://wiki.osqa.net/display/docs/RHEL%2C+CentOS+5+Installation+Guide#RHEL%2CCentOS5InstallationGuide-Python
I'm able to install python 2.6 separated from the yum version. But when I run ./easy_install ElementTree I get this strange error:
Traceback (most recent call last):
File "./easy_install", line 9, in <module>
load_entry_point('distribute==0.6.14', 'console_scripts', 'easy_install')()
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 305, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 2244, in load_entry_point
return ep.load()
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 24, in <module>
from setuptools.package_index import PackageIndex
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/package_index.py", line 2, in <module>
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
File "/opt/ActivePython-2.6/lib/python2.6/urllib2.py", line 93, in <module>
import hashlib
File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
I do not understand python and have no idea how to fix this issue, I'm trying to install OSQA to run a phpBB support forum for another country.
Thanks for any help, best regard's.
My guess having had a similar issue on CentOS before, is that the ld path for the new Python isn't set, and it can't find its loadable modules folder.
The 3rd code block on this blog post shows setting an ld path for an opt Python (though it is 2.7): http://toey.tc20.net/2010/08/04/install-python-2-7-gevent-on-centos-5-x86_64/
I would assume that an installer would have done this as part of the install step, but maybe the blog post above will be of some help.
I had the same problem and found that the issue is unrelated to _md5.so, but instead that hashlib is failing to import _hashlib.so within a try block, then getting to a different and normally unused section of code (where the _md5 problem shows up). Try:
import _hashlib.so
I got something like:
ImportError: <PATH>/lib/python2.7/lib-dynload/_hashlib.so: cannot restore segment prot after reloc: Permission denied
I googled that and found http://www.quantumwise.com/forum/index.php?topic=16.0 which says you need to do:
chcon -t texrel_shlib_t <PATH>/lib/python2.7/lib-dynload/_hashlib.so
This worked for me.
Activepython 2.6 seems to have some problem in their latest build. please check for its former release.
I also encounter the same issue like you, I fix it after I add the lib path of python where the module will be installed.
It is really caused by LD_LIBRARY_PATH, please try to add "/opt/ActivePython-2.6/lib" into your LD_LIBRARY_PATH.
setenv LD_LIBRARY_PATH /opt/ActivePython-2.6/lib:$LD_LIBRARY_PATH
Credit to http://johnsofteng.wordpress.com/2009/06/21/python-importerror-no-module-named-_md5/
I met the similar problem on Redhat 6.4, python binary (2.7.x) packages is copied from other already installed system (which is built from source).
The problem is the _hashlib.so, which miss the libssl.so.0.9.8
bash-4.1# ldd /proj/application/tools/python2.7/lib/python2.7/lib-dynload/_hashlib.so
linux-vdso.so.1 => (0x00007fff51d6f000)
libssl.so.0.9.8 => not found
libcrypto.so.0.9.8 => /usr/lib64/libcrypto.so.0.9.8 (0x00007f9a69746000)
libpython2.7.so.1.0 => /proj/application/tools/python2.7/lib/libpython2.7.so.1.0 (0x00007f9a6936b000)
I just install missed package and soft link to the library.
bash-4.1# yum install -y tar openssh-clients
bash-4.1# ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
Then the setuptool installation is successful

Categories