PyEphem running error on Ubuntu - pyephem

I have read previous posts on installation issues. Nothing seems to work.
I have Ubuntu 14.04LTS, 32 bit, Anaconda python ver 2.7.
I installed pyephem using sudo pip install pyephem [after checking I have python-dev, and latest pip] Installation said it was successful.
When I run Python 2.7 and try to import ephem, it says Import error:
No Module named _libastro.
Any help will be appreciated.

If you are using Anaconda and have activated your conda environment, you should not need to use sudo — that might aim the install at your system Python, the one governed by the root account and by sudo, instead. You could try activating your conda environment and then just doing conda install ephem because it comes built in to conda, you do not need pip plus a compiler to try installing it!

Related

I can not install OpenMDAO

I have installed Anaconda since it was recommended to use in the OpenMDAO's website. After that I typed pip install 'openmdao[all]' as instructed. However I get an error message saying, "ERROR: Invalid requirement: "'openmdao[all]'"" I was wondering how can I solve this issue. I have no knowledge about the Python or anaconda therefore I don't have a clue what to do about this situation. I searched the internet however I didn't find a solution to this. Thanks in advance!
It's possible you're running the wrong pip executable. Try which pip - it should be located under your home directory instead of a system path such as /bin/pip or /usr/bin/pip.
Make sure you've created and activated an environment in Anaconda:
conda create -n myenv pip
conda activate myenv
python -m pip install 'openmdao[all]'
That command sequence will give the highest chance of success. The single quotes are required for shells like zsh.
Remove the single quotes:
pip install openmdao[all]

Not able to install feature -Engine Module

I am trying to install feature-engine module on anaconda
this is the error i am getting
Package is not available from current channels
repo.anaconda win 64 , noarch etc.
Can you please help me with the problem?
Thanks,
RD
to install from anaconda:
conda install -c conda-forge feature_engine
I believe that feature-engine is not available through anaconda channels for installation with conda install. I was able to install it via pip. Here is how I did it (in Windows):
open a CMD and run conda activate <<VIRTUALENV>>. This is the environment you create for your project. If you have not created one, then use base, the default one.
cd to the location of your pip installation within that activated conda Virtual environment (mine was within my user folder in \AppData\Local\Continuum\anaconda3\envs\<<VIRTUALENV>>\Scripts).
in there, run pip install feature-engine
you should now be able to see it listed under pip freeze or pip list, but not under conda list.
Finally, go to your code location and run the code. remember to activate that same <> each time you open a new CMD to run it.
Hope it helps.
If you are using Jupyter Notebooks, it might be the case that your Jupyter Notebook is not actually running the kernel in your (activated!) Anaconda environment (via this answer), but the generic Python3 kernel that only can import packages from your global Anaconda environment.
You can check for this by importing a package that is installed in your global environment (e.g., pandas), while running a notebook:
import pandas
pandas.__file__
If you see something likes this (on Windows), you are indeed running the wrong kernel (as you would expect the packages to be loaded from the activated environments):
'C:\\Users\\<user>\\Anaconda3\\lib\\site-packages\\pandas\\__init__.py'
Therefore, in your Anaconda Prompt, you have to create a new kernel within ipykernel (assuming cenv is your environment of interest):
$ conda activate cenv # . ./cenv/bin/activate in case of virtualenv
(cenv)$ conda install ipykernel
(cenv)$ ipython kernel install --user --name=<any_name_for_kernel>
(cenv)$ jupyter notebook
Now, in the restarted Jupyter Notebook you can change the kernel via the menu: Kernel > Change kernel > <any_name_for_kernel>
Importing the same package, like pandas, should show the following file path:
'C:\\Users\\<user>\\Anaconda3\\envs\\<cenv>\\lib\\site-packages\\pandas\\__init__.py'
and you should be able to import any package installed in that Anaconda environment.

Trying to import docx in Python

Fair Warning: I am extremely new to python, so please excuse any dumb mistakes I make =)
I would like to be able to open/close/manipulate/read Word documents (docx files) on my Mac using Python. The python-docx module looked really useful, so I have been trying to install it on my system, to no avail.
Here's what I've done so far:
Checked that I do indeed have python installed using the python --version command in terminal. I have version 3.7.0, so all good there.
Checked that I do indeed have pip installed - I was able to use pip install and pip uninstall commands, so all good. I also upgraded my pip version using pip install --upgrade pip to pip-19.1.1
Following the online documentation (see here), I tried pip install python-docx. This seemed to work just fine, and after the progress bar loaded all the way I saw:
Successfully built python-docx
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: python-docx
Successfully installed python-docx-0.8.10
I wasn't completely sure what pyhamcrest was, but I installed it anyway just to be safe using pip install pyhamcrest
As other sites suggested, I also tried to install Pillow, lxml, and python-dateutil using their respective install commands, and in each case saw the Requirement already satisfied: message, with an anaconda path listed.
Frustrated, I also tried easy_install python-docx, the manual version, and even pip install docx . In all cases, when I run IDLE and type from docx import Document or just import docx, I get the following message in the shell:
`Traceback (most recent call last):`
`File "/Users/[my_name]/Desktop/Medical.py", line 3, in <module> `
`import docx`
`ModuleNotFoundError: No module named 'docx'`
Could anyone help point me in the right direction? Thank you very much.
The Anaconda Python distribution has its own system of installation of packages.
After the installation of Anaconda, the variable $PATH has been modified so that anaconda python was the first, and OsX's python in the last position.
If you type "python" in a shell will execute the anaconda python, instead of the standard OsX python (which is 2.7, not 3.x).
Following the instructions of the package python-docx, you have installed it using pip, which is the default method for installing packages, but this method is not valid for Anaconda Python. So, you finished installing python-docx for the python 2.7 of OsX.
To install packages for anaconda, you must run the command
conda install <package>
The python-docx module for anaconda can be found in a separated repository called conda-forge; typing the command
conda install -c conda-forge python-docx
you will install the package and the requested dependencies.
Other useful commands are:
anaconda-navigator for exploring the Anaconda system
anaconda-project for managing projects with anaconda
idle3 for Anaconda Python shell.
Before start coding, run anaconda-navigator and take a look at the 'Learning' section.
For a better experience, I suggest PyCharm IDE for Anaconda from JetBrains.

Install conda package from Google Datalab

I'm looking to use the ospc taxcalc package in a Google Datalab notebook. This package must be installed via conda.
Datalab doesn't have conda by default, so this method (from https://stackoverflow.com/a/33176085/1840471) fails:
%%bash
conda install -c ospc taxcalc
Installing via pip also doesn't work:
%%bash
pip install conda
conda install -c ospc taxcalc
ERROR: The install method you used for conda--probably either pip install conda or easy_install conda--is not compatible with using conda as an application. If your intention is to install conda as a standalone application, currently supported install methods include the Anaconda installer and the miniconda installer. You can download the miniconda installer from https://conda.io/miniconda.html.
Following that URL, I tried this:
%%bash
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
wget works, but the bash command to install just kept in "Running..." state for seeming perpetuity.
This seems to be due to the conda installer prompting for several Enter keystrokes to review the license, and then for a yes indicating acceptance of the license terms. So conda's silent mode installation looked promising:
%%bash
bash Miniconda2-latest-Linux-x86_64.sh -u -b -p $HOME/miniconda
This produced the following warning:
WARNING: You currently have a PYTHONPATH environment variable set. This may cause unexpected behavior when running the Python interpreter in Miniconda2. For best results, please verify that your PYTHONPATH only points to directories of packages that are compatible with the Python interpreter in Miniconda2: /content/miniconda
And doesn't make available the conda command:
%%bash
conda install -c ospc taxcalc
bash: line 1: conda: command not found
There is a pending github issue tracking this work - https://github.com/googledatalab/datalab/issues/1376
I believe we will need to install conda and use that for python, pip and all other python packages, and in the interim it may not be possible to mix the two python environments. However someone with more experience with conda might know otherwise.
As of the 2018-02-21 release, Datalab supports Conda and kernels are each in their own Conda environment.

Created an Anaconda python3 environment but it still loads ipython 2.7.6

So I installed Anaconda on my Ubuntu linux 12.04LTS x64 box. It seems to work fine except for this. So I created a conda environment using the
conda create -n py33dev python=3 anaconda
When I try to run the ipython shell, I would expect to get the Ipython3 shell and notebook. However, it still loads the ipython 2.7.6 shell. I tried using the ipython3 command, but it will then load an ipython3 shell from my computer and not from Anaconda.
I tried to install ipython3 to the Anaconda environment using
pip install ipython3
and
conda install ipython3
However, when I do this I just get a message saying "No packages found matching: ipython3"
So I am not sure why Anaconda runs fine with python2 but not with python3--even though Continuum indicates it is python3 ready. Am I missing a step anywhere? Does anyone know how to solve this?
Did you remember to do "source activate py33dev"?