anaconda and point cloud library - python

Can you tell me how can I configure point cloud library to be used with anaconda, I have never used point cloud before. I have installed pcl1.6.0 all in one installer, openNI and PrimeSense. But even after this when I run my python code in anaconda it gives me the error:
ImportError: No module named pcl
Do I need to copy my pcl1.6.0 folder in the site-package folder if anaconda?
the code is here:
import pcl
p = pcl.PointCloud()
p.from_file("C:\Users\Kangkan\Desktop\ikea.png")
fil = p.make_statistical_outlier_filter()
fil.set_mean_k (50)
fil.set_std_dev_mul_thresh (1.0)
fil.filter().to_file("inliers.pcd")

You can try this:
conda install -c sirokujira python-pcl --channel conda-forge
Found solution on this website [https://anaconda.org/sirokujira/python-pcl] yesterday.
I am using Python 3.6 in Anaconda3 for Windows10(64).Hope this would be useful for you.

You could try:
conda install -c https://conda.anaconda.org/ccordoba12 python-pcl
This references wasn't available when you asked the question, but using it worked for me! https://anaconda.org/ccordoba12/python-pcl.
I am using windows and ran the conda install line with cygwin.

Related

Python sndfile library not found on newly installed Mac

(my first post here) I have a problem with the librosa python library, which produces the following error.
OSError: sndfile library not found.
I installed the librosa library and the SoundFile library with pip install and with conda install -c conda-forge librosa. I also installed the libsndfile library with homebrew in an external git folder but I'm not sure if that's even the problem and if it is, where to put the git repository, in which I installed the library.
Apparently, the python environment tries to retrieve the library files from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_soundfile_data/libsndfile.dylib but they are actually located at opt/homebrew/lib/libsndfile.dylib.
I tried doing this:
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
but it didn't work and I really don't know what else to do..
Maybe there's just some library I haven't installed or haven't installed in the right directory?
Screenshot of PyCharm console output after running a program that uses librosa
I am working on a brand new MacBook Pro M1 Max with
MacOS Monterey
Python 3.9
librosa 0.9.1
SoundFile 0.10.3
Newest PyCharm community edition
Thanks in advance!!
For a sound project on python using M1 cpu (arch arm64), I have encountered the same issue.
conda install -c conda-forge libsndfile
working on python 3.10
might need conda activate, check brew install miniconda
miniconda is similar to pyenv/pipenv in short

python library install Questions

I use Python and pycharm as a tool.
If you use the pip statement to install the library, you will get an error.
For example, if I want to download the torch (1.6.0) version and type pip install torch==1.6.0,
It says no version.
This is not the end, but some libraries continue to cause strange conflicts and will not be installed.
For example, if you type pip install poro to install the poro library, an unknown error pops up and the installation fails.
I'm not asking for a pororo installation.
My question is, I want to know how to download the library without relying on pycharm.
I want to download it separately from a site like pypi and put the library directly into the virtual environment (conda).
What should I do?
The following worked for me:
First, install mkl using conda:
conda install -c anaconda mkl
Then run this:
conda install -c pytorch pytorch

Conda install geopandas doing nothing

I'm using conda with Spyder/Python 3.8.8.
I'm trying to install the geopandas package through conda-install, but when running it, I receive no output.
I've input the command conda install -c conda-forge geopandas and let it run for 30 minutes so far, so I doubt it's just a large package or poor connection. I don't know if I'm supposed to be seeing progress updates, but if I am, I'm not.
Any help is appreciated, thanks!
If you are using the base Anaconda environment, then there are packages that are conflicting with geopandas. I suggest you to create new environment for geopandas:
open anaconda command line and run this command to create new environment:
conda create --name gis python==3.8
You can use any version of python you like of course. Then you need to activate it:
conda activate gis
Now you can install geopandas and jupyter lab if you need it (Personally recommend VSCode):
conda install -y -c conda-forge geopandas jupyterlab
enter code here
Use below command to install,
conda install geopandas
or
pip install geopandas
When using pip to install GeoPandas, you need to make sure that all dependencies are installed correctly.
fiona provides binary wheels with the dependencies included for Mac and Linux, but not for Windows.
pyproj, rtree, and shapely provide binary wheels with dependencies included for Mac, Linux, and Windows.
Windows wheels for shapely, fiona, pyproj and rtree can be found at Christopher Gohlke’s website.
Depending on your platform, you might need to compile and install their C dependencies manually. We refer to the individual packages for more details on installing those. Using conda (see above) avoids the need to compile the dependencies yourself.
This solution might not be exactly relevant, but since there is no marked solution, it might help...
I recently ran into a problem installing geopandas as well. Though I did mine through my terminal and I did receive an error message: OSError: could not find or load spatialindex_c-64.dll.
I used: conda install -c conda-forge rtree=0.9.3.
Check out this post for more info.

Trying to install new libraries on Spyder (Python 3.7)

I am new to python and I am having trouble downloading some new libraries that don't appear to be pre-installed. The names of them are rasterio and retrying. I continuously get an invalid syntax error, and I have tried using some different suggestions found online.
pip install rasterio
Above is the way I was attempting to do it, and I also tried without the pip in there, but neither option worked. I am new enough to the language that troubleshooting is very difficult. Any help is greatly appreciated!
There are several ways to install rasterio, using anaconda you have the documentation here: https://anaconda.org/conda-forge/rasterio
If you are on windows installing rasterio using pip install can be difficult since it requires binary wheels, but here is the tutorial: https://rasterio.readthedocs.io/en/latest/installation.html
I advise you to use linux since it is much easier to install packages, you can either install a dual boot or a virtual box.
I suppose you are using Spyder IDE with Anaconda. So, to install rasterio package you can open anaconda prompt and type:
conda install -c conda-forge rasterio
For further information about package installation check out this link.
Also, to install any conda packages just google it once, you will find instructions to install it mostly in anaconda's official site.
Edit:
Please remove the rasterio package once. And install it again, see if works. If it doesn't work create a new environment like: conda create --name myenv. Then install rasterio again.
If this still doesn't work, try to install rasterio from here like conda install -c ioos rasterio.

Can't import a package installed in anaconda

I have a simple question. I have install resampy using anaconda
conda install -c conda-forge resampy
Now when I import resampy into my python program, it still returns the error saying Import Error: No module named resampy
But conda says it is installed. Can someone help me out where I'm doing something wrong?
The major confusion that I come across is: When I install a package using anaconda, does it install just like any other package installed via pip? Can I import and use it just like any other package?
Please someone help me out of this.
I have the same experience, somehow in the PATHs that Anaconda created, it does not include the full path to the package installed via conda install.
As workaround, i use:
import sys
sys.append(full path to the site-package directory)
in my case:
sys.path.append("C:/Users/rpo/AppData/Local/conda/conda/envs/tweet/Lib/site-packages/")
I experienced this for one package in both linux and windows conda environment, i guess could be package specific issue.
I guess the best way to manage packages be it anaconda or plain python is to first create a virtual environment. Thereafter, all packages you install will be available to you when you activate this environment. Managing Python in this way keeps things easy and savvy and allows you to work with several versions of Python if you require.
Create a virtual environment
Specifying the version is optional.
conda create -n [env_name] python=[python_version]
Activate the virtual environment
source activate [env_name]
Install all your packages
You can now install either packages from anaconda. They will all be installed.
conda install [package_name(in this case resampy)]
And for the rest of your questions refer this:
What is the difference between pip and conda?
For more on managing environment refer this:
https://conda.io/docs/using/envs.html#

Categories

Resources