simpleitk installation in anaconda - simpleitk

i installed simpleitk in anaconda using command
conda install -c simpleitk simpleitk then followed link https://github.com/SimpleITK/SimpleITKCondaRecipe to build it but it's not connecting to itk.org to build.
import SimpleITK as sitk on jupyter notebook is working but sitk.show() is not working. moreover when i tried to follow the commands from http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/00_Setup.html,
from downloaddata import fetch_data, fetch_data_all not working.
even the command fetch_data_all(os.path.join('..','Data'), os.path.join('..','Data','manifest.json')) is not working. i am very new to simpleitk and don't know whether it is due to build not processed. please tell me how to solve my problems. i have been trying from many days, pl help me. moreover how to make imagej as default for simpleitk. i know lots of questions but i would be greatful if solved.

You seem to be having multiple problems, all of which have to do with installing a working environment and less specific to SimpleITK.
You installed SimpleITK using the conda install command, so there was no need to build it using the conda build command. Check that you have it installed correctly and see which version you have:
import SimpleITK as sitk
print(sitk.Version())
The functions fetch_data and fetch_data_all are part of a module found in the SimpleITK notebooks repository. To use the code from that repository you will need to clone it using git:
git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks.git
Then you can run the notebooks or copy the relevant modules to your directory and work with them there.
The sitk.Show() command assumes that you have the ImageJ/Fiji program installed which is likely why it is not working (I am guessing here as you did not provide sufficient detail).

Related

Regarding "torch" package - with anaconda environment using vscode as editor

I am currently working on project,where I use pytorch as deep learning environment. I have serious problem, that .... "When I use anaconda jupyter notebook terminal to run my *.py files. Then, it run properly. But, when I use the same environment within vs-code via python_interpretor, I can not get result and give me error "torch module can not found".
Can anyone have solution?. Actually, I see the packages using "conda list" and it includes torchvision inside environment. I also tried to install torch in base environment But, it does not work.
Please give me some solution. Thank you for your consideration.

pycharm packages not displayed in the project interpreter window

I am using pycharm 5.0.4 community edition.
I wanted to install package fuzzywuzzy.
But when i go to project interpreter window and try to install package, it shows me no available packages.
Can it be issue because I am using my work desktop.
Thanksenter image description here
Can you provide more details- Are you not able to see any packages? Try searching for some other packages like pip, matplotlib, django, numpy etc. Sometimes it takes time for the IDE to build skeletons before you can actually start installing the packages. So once the IDE wait for it to complete its setup and then try to access the installation packages available.
Also if you do you have any other python interpreter installed on your local machine? If so then try switching to that interpreter.
Below are some steps you can try, which worked for me:
Step-1 Activate your intelpython using:
source <your installation path>/bin/activate
Step-2 Clone the environment using conda clone command and make sure the pwd is ~/:
conda create -n <source_environment> --clone <destination_environment>
Step-3 Activate the cloned environment:
source ~/.conda/envs/<your_environment>/bin/activate
Step-4 Provide read-wite permissions to intelpython and cloned enviroment using:
sudo chown -R <user_name>:<group_name> /<path_to_directory i.e. /opt/intel and ~/.conda/envs>
Step-5 Open Pycharm and in System Interpreter add the path to above created enviroment and then you can use pip or Pycharm itself, it should work.
I had a similar problem. I was using the Intel python distribution, and installing packages required write permissions to the folder that intelpython was installed in, which in my case was /opt/intel/intelpython2.
Try adding write permissions to the folder using the following command:
sudo chown -R <username> </path/to/folder>
Then try adding missing packages and/or repositories as seen in this page - https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html.

Install Ipython notebook without Internet connection

I followed these instructions:
http://ipython.org/install.html
Used last way to install (downloading source and "python setup.py install").
After that, console ipython worked fine, but trying to run notebook gave me error.
I always searched errors in Google and it always was a missing package.
Notebook probably depends on external packages.
After manually installing 2 packages it still gave me error.
Gave up and uninstalled everything (including Python itself).
Is there any way to manually download and install the notebook?
Do you know of any finite number of files/packages I have to download and install so the notebook will run just fine?
Thank you.
As you are using Windows, I suggest you to install Winpython.
It includes all the libraries and tools (e.g. IPython) you will need in the same executable. So you only need to download the desired version and then you can pass that version using a USB stick to the computer without internet.

IPython notebook kernel dies on import

I am running IPython Notebook on Enthought's Canopy 64 bit distribution, Ubuntu 14.04.
I've tried install libtiff, but when I import it in IPython Notebook, the kernel always dies at the import statement. What could possibly be causing this? Canopy is my default Python distribution, my paths all seem like they're set up appropriately, although I'm convinced that something in my Python setup is borked.
Any advice is appreciated.
EDIT: I'll be more specific. Output of sys.path:
['',
'/home/joe/Enthought/Canopy_64bit/User/src/svn',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python27.zip',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/plat-linux2',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-tk',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-old',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/lib-dynload',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages',
'/home/joe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PIL',
'/home/joe/opencv-2.4.9',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages',
'/home/joe/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages/IPython/extensions']
As for how to install Python packages, I assume I go to ~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages and run pip, setup.py, or a shell script, per the specific package's instructions. Is that correct? The article that I linked has the following line: "To install a package which is not available in the Canopy / EPD repository, follow standard Python installation procedures from the OS command line.", which seems to imply that I install per package instructions.
In .bashrc, I have the following:
VIRTUAL_ENV_DISABLE_PROMPT=1 source /home/joe/Enthought/Canopy_64bit/User/bin/activate
export PYTHONHOME=/home/joe/Enthought/Canopy_64bit/User/bin
export PATH=/home/joe/Enthought/Canopy_64bit/User/bin
export PYTHONPATH=/home/joe/Enthought/Canopy_64bit/User/bin
From what I understand of the linked articles, this means I'm setting Canopy User as my default Python distribution. I'm sure I'm doing something a bit over my head here, but I can't understand what else I need to do to fix this issue.
Worse yet, now I'm getting an "ImportError: No module named site" with these .bashrc settings, when trying to start IPython notebook or python from the command line. I can run only from the Canopy GUI.
Closing this. I made it harder than necessary.
It turns out, the PYTHONHOME and PYTHONPATH .bashrc variables were causing some conflicts. Commenting them out seems to have resolved the issue.
Installing outside packages does, indeed, happen from the home (~) directory.

Import error when using a python script that do not occur in ipython

All my install for python were working pretty well since soon. Now, I have a weird issue that generates import errors for some of my Python scripts and when using Ipython those import performs as expected.
This issue does not depend on the working dir (tested this several times with the same result). And I didn't change anything in my .bashrc regarding PYTHONPATHs.
So this might be a noob question, but is there an option in Ipython to display everything Ipython is doing when I run a command, so that I can track which is the package Ipython succesfully imported?
The packages I have trouble with are actually yaml, matplotlib cloud Image. Is it possible that an update from 2.6 to 2.7 is responsible for that? (I work on OSX Lion and most of the packages are installed via macports and updated using the upgrade outdated command).
As I think I can probably fix this myself with the command I asked for, don't bother seeking further for package compatibility or anything if you got the Ipython command that might suits me.
The difference of imports between python and ipython resulted from a cross defined python reference library (when installing most of the python libraries with macports and some without any known ports with other package managers).
Reinstalling the whole python libraries using the process described in http://astrofrog.github.io/macports-python/
corrects the issue and it is preferable to install manually the libraries that don't have any known ports (for instance with a setup build/install process).