How can I import PCL into Python, on Ubuntu? - python

So my situation is as follows: I am on an Ubuntu 14.04, and I am very simply, trying to use PCL (point cloud library) in Python 2.7x.
I followed the instructions here,(http://pointclouds.org/downloads/linux.html), however in Python if I now do
import pcl
I still get the error:
ImportError: No module named pcl
I am not sure what else to do - there do not seem to be any more leads I can follow... thanks.

You can try python-pcl.
It is a python binding and supports operations on PointXYZ.

Related

Error when calling Python ecCodes module from Matlab

I am trying to run a Python function from Matlab, but I get an error due to a missing library (the ecCodes library).
I tried to check the missing library by simply importing the module in Matlab:
>> py.importlib.import_module('eccodes')
Error using bindings><module> (line 35)
Python Error: RuntimeError: Cannot find the ecCodes library
However, I am perfectly able to import the module directly in Python through the Spyder IDE, as well as other Python modules from Matlab.
Furthermore, the ecCodes module should be in the Matlab search path, as it is located in:
C:\Users\username\AppData\Local\Continuum\anaconda3\Lib\site-packages\eccodes
Calling:
>> py.sys.path
in Matlab shows that the parent-folder is in fact included:
C:\Users\username\AppData\Local\Continuum\anaconda3\Lib\site-packages
Has anyone faced similar issues when calling Python from Matlab?
Thank you in advance!

math.prod() is not working in google colab notebook

I have executed this code in Gooogle ColabNotebook...As per the link given below...
prod() is available under math module. But why prod() is not working..its giving me the error?
https://www.w3schools.com/python/ref_math_prod.asp
import math
print(math.prod([1,2,3,4,5,6,7]))
Output
AttributeError: module 'math' has no attribute 'prod'
math.prod() is a new function available in Python versions 3.8 and later. Google Colab's kernel, as of this writing, runs Python 3.6.9. As such, math.prod() won't be available for your use.
You can try to install a Python 3.8 kernel in Colab, but it seems some folks have some mixed results, and the method in the accepted answer is a bit hacky, but might work for your purposes.
Google Colab uses Python 3.6. 9 as of 2021. and math.prod() is in python 3.8 version
you can use this
from functools import reduce
import operator
print(reduce(operator.mul, [1,2,3,4,5,6,7], 1))

import clientsecrets ImportError: No module named 'clientsecrets'

I have installed google-api-python-client library using pip3.4 Iam following tutorial from google authenicating client library so every time i run the python code provided by google to authenticate client library throws error as
import clientsecrets ImportError: No module named 'clientsecrets'
I have only python3.4 running on my pc and no other python. it might be similar thread to one here Python can't find module 'clientsecrets' when trying to set up oauth2 in Django using the Google Python API
but i found no solution there.
The python code i got from google is here
https://developers.google.com/maps/documentation/tracks/auth#authenticating_using_a_client_library
The library doesn't support Python 3. As of PEP 404:
In Python 3, implicit relative imports within packages are no longer available - only absolute imports and explicit relative imports are supported.
The oauth2client library uses import clientsecrets, which for Python 3 would need to be rewritten as from . import clientsecrets. Even if you changed those, the rest of the library would still be incompatible with Python 3.
There's at least one fork for Python 3 development, but it doesn't seem to be a big priority for the project. Until then, you'll have to find another library or write a wrapper yourself with requests for the functionality you need.

import Error while importing python nltk module in node.js using "python-node" module

I am trying to import python natural language processing toolkit nltk in node.js using node-python mentioned here: https://npmjs.org/package/node-python
The commands i am giving are similar as mentioned on the npm module site:
var python = require('node-python');
var os = python.import('os');
i am getting the following error:
Error: /usr/lib/python2.7/lib-dynload/datetime.so: undefined symbol: PyExc_SystemError
at repl:1:25
at REPLServer.self.eval (repl.js:109:21)
at rli.on.self.bufferedCmd (repl.js:258:20)
at REPLServer.self.eval (repl.js:116:5)
at Interface.<anonymous> (repl.js:248:12)
at Interface.EventEmitter.emit (events.js:96:17)
at Interface._onLine (readline.js:200:10)
at Interface._line (readline.js:518:8)
at Interface._ttyWrite (readline.js:736:14)
at ReadStream.onkeypress (readline.js:97:10)
I am using python2.7.2
After much search i found that this is a known bug in python2.7 and found a similar problem when importing from C here is the what i found:
similar error found while importing python datetime module from C
The problem seems to be in the datetime.so module, i was thinking of getting the updated version of the datetime module and compiling it separately to make it work. I am still looking for that module and comple instructions. I would really appreciate If anyone has a better suggestion to resolve this or even help me locate the place to find this datetime module and its compile instructions. I really don't want to compile the whole python to make it work.

error on importing pyIpopt

I'm trying to install and configure pyIpopt. Ipopt is already installed and the examples run fine.
From the shell, when I do import pyIpopt, I get the error:
ImportError: /***PATH***/libipopt.so.1: undefined symbol: MPI_Init
The FAQ section of the pyIpopt git project has this to offer for these kinds of errors:
Do a Google search to find the library file, and add
-lWhateverLibrary in the makefile of pyipopt.
I've googled and found this: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Init.html.
I don't know how to get the library or add it to the makefile... Any assistance would be much appreciated!
Just had a similar problem on ubuntu.
Using libmumps-seq worked for me:
installed libmumps-seq-4.9.2 (just with apt-get, along side the ordinary libmumps)
in setup.py changed in the libraries list argument 'coinmumps' to 'dmumps_seq-4.9.2'
rebuilt and installed.
If I understand it correctly, the default mumps is distributed (using MPI lib which can be a world of pain), and all i needed is the sequential one, which mumps-seq provides.

Categories