Anaconda VTK install missing VTK module? - python

Win 10, x64, Python 3.6.6 & Python 2.7.12 (I tried the code in both), IPython 6.1.0
So far I am only able to run VTK projects using Visual Studio in C++ but would like the ease of using an interpreted language for development. So I installed the latest VTK via the Anaconda command prompt, conda install -c anaconda vtk
No problems everything updated & superseded as necessary. So I tried out a trial program from the Python examples only to get...
ModuleNotFoundError: No module named 'vtk'
I added C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\pkgs\vtk-8.1.0-py36he6bbf13_201\Lib\site-packages\vtk to my PYTHONPATH in Spyder but I still get the same error.
Any idea why IPython cant see the vtk library?
EDIT: VTK shows up as an installed library when I type conda list at the command line

The following worked for me. Make sure to use the Anaconda Prompt.
# Create a new conda environment mypy3env and install vtk.
conda create -n "mypy3env" python=3
conda activate "mypy3env"
conda install -c conda-forge vtk
# Verify that python3 from Anaconda is used!
where python
python --version
# Test if vtk installation was successful
python -c "import vtk; print(vtk.vtkVersion.GetVTKVersion())"
See also the comments here to verify the Anaconda installation.

I tried to create a new environment and the vtk module works for Python version 3.6. When using a newer version of Python the vtk module cannot be loaded Exception has occurred: ModuleNotFoundError No module named 'vtkmodules.vtkCommonCore'(I don't know why).
conda create --name MyEnv python=3.6
conda activate MyEnv
pip install vtk

Related

i install conda installed and Python installed seperately

i have Conda installed and Python installed separately, when i run .py file it is referencing to python's packages not from Conda so some pkg are missing(pandas), Conda has pandas but not Python. all default installations are go to Conda pkg files. how do i install pandas to Python that is not in Conda?
To run a file from conda, simply go to your anaconda prompt and cd into the drive. Similarly, you can search for your python prompt from the start bar and run code from there.
To install pandas into your python installation type:
pip install pandas
If you are running code from an IDE or code editor, you need to go into your settings and change the default runtime environment to anaconda. Even easier, open your anaconda navigator and then run your editor from there.
Your conda installation can't not have python, although it might be running the wrong version of python for your code. To change the version of python type:
conda install python=$pythonversion$
into your conda prompt.

Spyder IDE plugins installation (spyder-unittest)

I am trying to install a plugin for the Spyder ide called spyder-unittest (description here).
I am using:
MacOS X Version 10.14.6
Anaconda Navigator 1.9.7
Spyder 3.3.6
Python 3.7
After a first attempt using the command
conda install -c spyder-ide spyder-unittest
the plugin did not work (i.e. the additional command Run unit tests was not available under the Run menu).
I also tried, without success:
conda install -c conda-forge spyder-unittest
I then uninstalled and installed once again Anaconda navigator, and tried conda install -c spyder-ide spyder-unittest. This time, I got a very lengthy output, indicating conflicts (please see image):
Now, I do not know what to do. Could someone please offer any help?
I also tried to install after going, through the Terminal, to the directory where I thought the Spyder plugins were installed. Same output as above.
Thank you very much in advance.
Cheers,
Orlando
I managed to install spyder-unittest without any errors on my computer.
I suggest creating a new environment to avoid any conflicts with other packages when installing.
First create a new environment using:
conda create --name env python=3.7
After creating the environment, activate it using conda activate env
Then install spyder-unittest using conda install -c conda-forge spyder-unittest

How to install mapnik python3 wrapper in conda?

I have installed mapnik 3.0.12 with conda install -c mrterry mapnik, but why I can`t import it in my code?
import mapnik
ModuleNotFoundError: No module named 'mapnik'
I looked in anaconda3/pkgs/mapnik-3.0.12-0/lib and there is no python3.7 folder there, only .so and .a files.
I have installed mapnik with sudo apt install python3-mapnik in ubuntu 18.04 and it imports well with /usr/bin/python3 interpreter. And in directory /usr/lib/python3/dist-packages/mapnik there is some .py files.
I'm not familiar with the tool, but it looks like Mapnik is a C++ library that has separate Python bindings. You need to install both mapnik and python-mapnik. Only Python 2 is supported, so you need to create a new env for this.
Conda (only if you trust the channel)
A search of Anaconda Cloud shows only linux-64 platform is available and only from user channels. I'm following your lead on using the mrterry channel, but generally I will only use a channel if I trust the user/org.
conda create -n myenv -c mrterry python=2.7 mapnik python-mapnik
Recommended Approach
Since I don't recognize any of the channels in the search, personally I would just follow the official install instructions. First, I would set up a Conda env with Python 2.7 and the dependencies that Mapnik lists. Then activate that env, and proceed with following the instructions (./configure, make, etc.).

Installed Opencv 3.4 with Anaconda Env Python Path - "No Module found"

I installed opencv 3.4.2 from source using this guide
One major change i did was point the python-executable to my anaconda3 env python3.6.
The configuration was passed successfully. However, when I activate the anaconda environment and try to import cv2. I get the no module named cv2 still.
But the opencv installed is shown in the conda list as here:
conda list -n anaconda-env | grep -i cv
Ouptut is :
libopencv 3.4.2 h765d7f9_1
opencv 3.4.2 py36h40b0b35_1
py-opencv 3.4.2 py36h765d7f9_1
Can anyone help me to know whats going wrong ? I am aware anaconda channel has a opencv pacakage. But it has only opencv3.1
The conda-forge organization contains one repository for each of the installable packages. Such a repository is known as a feedstock. A feedstock is made up of a conda recipe (the instructions on what and how to build the package) and the necessary configurations for automatic building using freely available continuous integration services.
If you want to check the Feedstock for opencv, it can be found here.
To install a package from conda-forge in a conda environment like anaconda, use : conda install -c conda-forge opencv

IPython Notebook - python3 not found after uninstalling Anaconda3 for Anaconda

I uninstalled Anaconda 2.3 with Python 3.4.3 and then installed the same Anaconda version with Python 2.7.10.
When I open a notebook via $ ipython notebook "Example Notebook.ipynb" it tries to use the python3 kernel as opposed to opening with the installed python2. Of course I get the error python3 kernel not found.
How can I get ipython notebooks to open with the python2 kernel? I've tried to uninstall ipython and ipython notebook, then delete .ipython and .jupyter from my user directory in case there were any defaults set in these folders, then reinstalled both. Still get the same problem.
Any help would be appreciated
You can install several python versions alongside each other. Just create another environment (replace "all my packages" with the names of the packages).
conda create --name mypy_27 python = 2.7
or
conda create --name mypy_34 python = 3.4
afterwards you can activate the environments by typing
source activate mypy_34
if you then do
conda install "all your packages"
you install the desired packages in the active environment.
You can do much more.

Categories