Distutils.core could not be found, where can I download it - distutils

Traceback (most recent call last):
File "setup.py", line 26, in <module>
from distutils.core import setup, Extension, Command
ImportError: No module named distutils.core
I get this error when installing ctypes.py on openwrt. Unfortunately, I cannot find the download link to the setup for distutils.core.
Can someone point me to it?

distutils ships in Python’s standard libary. Some operating systems think it’s not a regular module but only interesting for developers, so they move it to a python-devel package together with C headers, config files and co. https://dev.openwrt.org/ticket/793 tells me that this is the case for OpenWRT: you need to install python-dev to get distutils installed.

While logged in to openwrt try:
opkg update
opkg install distribute

Related

PythonAnywhere – How do I use the modules I install?

I'm confused by how I'm supposed to install/use new modules in PythonAnywhere.
For instance, I installed the module ephem in Bash console with
pip3.6 install --user ephem
Everything went alright. If I run the above command again it says;
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: ephem in ./.local/lib/python3.6/site-packages (3.7.7.0)
However, when I try to use it in my script I get:
Traceback (most recent call last): File "/home/krollibrius/montaulieu.py", line 7, in <module> import ephem ModuleNotFoundError: No module named 'ephem'
Can someone help?
Perhaps you used the wrong python version, try adding
import sys
print(sys.version)
to your script. I find that most of the time I install packages to the wrong version.
Another solution could be to use the command pythonwithversionnumber -m pip install --user ephem. Replace pythonwithversionnumber with the command you used to run your script

Geodjango Exception when importing django.contrib.gis.gdal: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

I have followed the tutorial for installing Geodjango on my Ubuntu 14.04. I am using Django 1.10 and Python 3.5, postgres-9.6 and postgis 2.3.
I have checked here and here, but found no solution.
In a newly installed ubuntu 14.04 Virtual Machine, it worked.
But in my installation, when I tried making migrations, I got:
OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name
Investigating a bit further, I tried simply:
from django.contrib.gis import gdal
And got:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/__init__.py", line 49, in <module>
from django.contrib.gis.gdal.driver import Driver # NOQA
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/libgdal.py", line 48, in <module>
lgdal = CDLL(lib_path)
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name
Is there any suggestions on how I could repair my setup?
UPDATE
It seems to be a problema with my conda environment. When I started using a pip virtualenv, the problem did not arise anymore. I am not answering the question, because I could not find the solution, only a workaround. But rebuilding the environment with pip virtualenv works.
In conda environment: conda install -c conda-forge gdal=2.2.1
In django settings.py:
GDAL_LIBRARY_PATH = '<HOME>/anaconda3/envs/<env_name>/lib/libgdal.so'
I was having this issue as well and the specifying
GDAL_LIBRARY_PATH = <HOME>/anaconda3/envs/<env_name>/lib/libgdal.so
(in project.settings or os.environ.setdefault) led to
libicui18n.so.56: cannot open shared object file: No such file or directory.
The fix that worked for me was to upgrade icu:
conda install -c conda-forge icu=58
Upgrading icu lead to some changes in other package versions as well (qt downgraded from 5.6.2-4 to 5.6.2-3, the rest upgraded).
I simply run under my conda environment:
conda install gdal
Guy de Carufel's solution did not work for me, though he pointed to a correct direction, thanks
Have you built SQLite from source? Then, you forgot to enable Column metadata. Recompile SQLite with
CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure
make
sudo make install
Have fun using the cutting edge SQLite.
Reference - https://www.sqlite.org/compile.html#enable_column_metadata

Installing XML::Parser requires expat.h

I'm working on a project that requires all third-party (read: CPAN) perl modules to be installed in a perforce repository, so that any code that depends on them can be successfully run without anyone else needing to manually install them. I ran into an issue though when trying to install XML::Parser. I use cpanminus to install my CPAN modules, so I ran cpanm -L . XML::Parser in the desired directory (this has worked before with other modules) and got the error:
Expat.xs:12:19: error: expat.h: No such file or directory
I'm used to using Ubuntu and apt-get, but at work I have to use RedHat and I'm not sure how to install expat to a local directory. I ran yum search expat and got
expat.i386 : A library for parsing XML.
expat.x86_64 : A library for parsing XML.
So I tried yum install --installroot=. expat.i386 and got the following errors:
Loaded plugins: rhnplugin, security
error: cannot open Packages index using db3 - No such file or directory (2)
error: cannot open Packages database in ./var/lib/rpm
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 157, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
self.conf
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig
self._conf = config.readMainConfig(startupconf)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 804, in readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 877, in _getsysver
idx = ts.dbMatch('provides', distroverpkg)
TypeError: rpmdb open failed
What am I doing wrong? Also, once I do get expat installed, I'm not sure how I would tell cpanm where to find it.
I see a couple of things that could help get you on the right path. First, the package you want is called expat-devel. Also, I think you need to provide an absolute path to the --installroot option, and you probably don't need to provide the package extension to yum unless this is relevant to how you building these modules (i.e., you can usually just do yum install expat-devel).
It also looks like something may be wrong with your rpmdb, since you got the "rpmdb open failed" message. You can run yum check to look for problems in rpmdb, but beyond that I can't say anything specifically going on with the package manager. Perhaps others can help more with that aspect.
just install expat by downloading it from http://sourceforge.net/projects/expat/ and
$ ./config
$ make
$ make install
Well, I found a workaround. I installed XML::Simple instead. At first it looked like XML::Simple required XML::Parser, but after some looking found out that it requires either XML::Parser OR XML::SAX, so I installed XML::SAX instead and got XML::Simple working. Good enough for my needs.

ImportError: No module named zope.interface

I am trying to run server for iphone using http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
My machine is mac 10.6.8
Python version : 2.7.3
I dont have any knowledge regarding python.
i have installed Twisted-12.1.0 additionally but still i am getting this error.
Traceback (most recent call last):
File "chatserver.py", line 1, in
from twisted.internet.protocol import Protocol, Factory
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/internet/protocol.py", line 15, in
from zope.interface import implements
ImportError: No module named zope.interface
later i have downloaded zope.app.wsgi-3.15.0 4 but i dont know how to use it.
The problem is that an __init__.py file is not present under zope directory so this directory is not scanned for imports.
Creating a blank __init__.py file under zope directory will do the trick.
I solved this error in UNIX by browsing to the zope directory by executing:
$touch __init__.py
I can confirm that this works also with virtualenv pip installation of zope interface
Here's a solution
It says that installing a zope module through pip breaks your zope installation because pip installs it in another directory other than the original zope module directory.
From the link
After install a zope module using pip, for example z3c.password your
zope installation gets broken.
This is because pip have installed the module in
/usr/local/lib/python2.6/dist-packages/zope and the original module
zope.interface is in /usr/share/pyshared/zope/interface/ and has minor
relevance when importing.
What worked for me is (also given in the link):
cd /usr/local/lib/python2.7/dist-packages/zope
sudo ln -s /usr/share/pyshared/zope/interface/
Off the top of my head you can use easy_install for this.
You will need the python-setuptools then you should be able to use
easy_install zope.interface
If I remember correctly however twisted should be installed as part of OS X python install. Do a quick Google for installing zope.interface for Mac OS X. As twisted is such a widely used library there is plenty of information out there.

libjingle compiling error

When compiling libjingle, on running the 'hammer.sh' on the swtoolkit,
i get the following import error,
root#den-pc:~/tejesh/libjingle-0.6.14/talk# sh ../../swtoolkit/hammer.sh
Traceback (most recent call last):
File "../../swtoolkit/wrapper.py", line 44, in <module>
import SCons.Script
ImportError: No module named SCons.Script
so how do i fix this import error... any suggestions?
i already setup the environment variables for scons (SCONS_DIR) and have all the libraries installed..
If you have SCons correctly installed, then it sounds like a problem with python not being able to find it. In addition to the SCONS_DIR environment variable, try including the SCons location in the PYTHONPATH environment variable.
when you install scons,in the README file,you can use:
# python setup.py install --standalone-lib
that can make scons modules into pythonpath.