Posts

Showing posts from 2019

Deactivate conda's base environment on startup

Image
When opening a terminal session, conda activates the base environment by default. If you want to prevent this default behaviour, you have three ways: Trick #1  :  Set the auto_activate_base parameter to false Trick #2  : Add conda deactivate in your bash configuration file Trick #3  :  Comment out some part of the conda initialisation code block in your bash configuration file NOTES: I'm working with  conda version 4.7.5 and  miniconda3 (it should also work with anaconda ). These tricks also worked with  conda version 4.6.14 After installing conda 4.7, conda added this block of code in my ~/.bash_profile : This is the block of code that we will modify in the following tricks Trick #1: set auto_activate_base  to false Per conda's instructions, "if you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false". Thus, enter the following command in a terminal: c...

Conda is broken after update: No module named 'conda_package_handling'

After updating my conda version 4.7.5 with conda update conda , conda is now broken. I get the following error message when doing conda info : ModuleNotFoundError: No module named 'conda_package_handling' NOTES: I'm working with  conda version 4.7.5  and  miniconda3 After trying to reproduce this bug, I am now getting the following error message when doing conda info : OSError: dlopen ( /Users/../lib/libarchive.dylib, 6 ) : Library not loaded: @rpath/libxml2.2.dylib EDIT [2019-07-29] :  I removed the temporary solution which consisted in downgrading your conda version since I found a complete solution (from a GitHub user) that allows you to work with the latest conda version 4.7.10 and Python 3.7.3 . See the solution below. Solution: re-install conda completely WARNING: the following solution involves the copying and deletion of the miniconda3 folder. Therefore, be very careful when handling the shell commands. I am not responsible for any data...

NLTK: Text.collocations() returns ValueError

Image
Book cover from  amazon.co.uk I was trying the collocations examples from  Chapter 1 , section 3.3 Collocations and Bigrams , of the book NLP with Python and I got the following ValueError The solution came from this NLTK’s issue on their GitHub  : Open  .../nltk/text.py    with your favorite editor NOTE: in my case the file was in ~/miniconda3/envs/nlp_py37/lib/python3.7/site-packages/nltk/text.py Change lines 440 and 441 from .../nltk/text.py    with the following line: print (tokenwrap( self . collocation_list(num, window_size), separator = "; " )) Now the collocations examples are working: text4 . collocations(num = 21 ) text8 . collocations() Output: NOTE: you can play with the argument num which refers to the maximum number of collocations to print.