I have tried various ways to install the library html2text and all end with ipython not being able in import it with the error message
"ImportError: No module named html2text"
The directory '/Users/NDunn/Library/Caches/pip/http' or its parent directory is not
owned by the current user and the cache has been disabled.
Please check the permissions and owner of that directory.
If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/NDunn/Library/Caches/pip/http' or its parent directory is not owned
by the current user and the cache has been disabled.
Please check the permissions and owner of that directory.
If executing pip with sudo, you may want sudo's -H flag.
Collecting html2text
Installing collected packages: html2text
Successfully installed html2text-2015.6.21
I have used sudo and -H sudo both of which say it has installed but then I can not import.
Any ideas on what is going on would be greatly appreciated.
In my case(ubuntu14) it has worked just with following command:
sudo python -m pip install html2text
html2text installed successfully.
Nowadays many systems come with multiple versions of python and therefore there can also be multiple versions of IPython.
When using pip install <package> it's not immediately clear to which interpreter the package will be belong in the end.
So how do we find out? Since unix based systems come with a very powerful shell we can use it to solve the problem:
which -a will list all ipython executables that are in your PATH. The first one will be called when you type ipython into your shell.
For me it's just:
which -a ipython -> /Users/ch/miniconda/envs/sb34/bin/ipython
Now we know that the standard ipython belongs to the interpreter /Users/ch/miniconda/envs/sb34/bin/python. So instead of calling pip install html2text, we can now use
/Users/ch/miniconda/envs/sb34/bin/python -m pip install html2text
to make sure that html2text is installed into the interpreter that also contains the default ipython executable in PATH.
Depending on the path and your user privileges, you may have to use sudo to gain sufficient writing permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With