Skip to main content

Installing virtualenv in Custom MSC Linux board

I am currently working on a Python project which runs on MSC board (with custom Linux OS). Even installing something as basic as virtualenv on this board needed some 'efforts'. 

So, I decided to summarize the steps that helped me to get python virtual environment working on this Linux based board. 
Hopefully, it might also help some other developers facing similar issues.
  •  Install virtualenv package
    I had to use '--trusted-host' flag for both pypi.org and 
    'files.pythonhosted.org' to avoid ssl certificate errors. 
    However, use of this flag should be avoided in general 
    because it overrides some essential security checks.
    
    python3.6 -m pip install --trusted-host=pypi.org virtualenv 
    --trusted-host=files.pythonhosted.org
  • Define symbolic library path
    We need to define path of 'libpython' symbolic library 
    corresponding to the Python version installed in MSC Board. 
    Otherwise, virtual environment creation throws error -
    
    /home/root/../..env/bin/python3.6: error while loading shared 
    libraries: libpython3.6m.so.1.0: cannot open sbelowhared 
    object file: No such file or directory”.   
    
    There are two ways to add Lib path:
    • Adding the lib path directly to '/etc/ld.so.conf'.      
       In my case, the library was located at ‘/home
       /root/berryconda3/lib’. 
          
       After saving the ldconfig file, activate it

       /sbin/ldconfig –v 

    • If you don't want to modify ldconfig file directly, 
       path can also be added by running the below command -

       export LD_LIBRARY_PATH=/home/root/berryconda3/lib
  • Create a virtualenv
    Now you should be able to create a virtual environment by  
    running -
    
    python3.6 -m virtualenv channelenv
  • Activate virtual environment
    source channelenv/bin/activate

    Notice that command prompt is changed and virtual environment 
    name is added as suffix
    (channelenv) root@msc-sm2-imx6dl:~/channels#  
  • Deactivate 
    That's easy! Deactivate virtual environment by simply running 
   
    deactivate

Comments

Popular posts from this blog

Solving PyCharm bug: "Python helpers are not copied yet..."

I have been using PyCharm Professional to run and debug Python code from my Windows machine to a remote Linux device. There are some other tools available for the same purpose (e.g. Python Tool for Visual Studio 2017). But in my opinion, PyCharm Professional stands out among its counterparts as it comes with a "All Batteries Included" setup. Once you configure remote Python interpreter in PyCharm, then it works out of the box. However, today after upgrading to PyCharm Professional 2018.2.1, I could not run my Python script on remote device. The execution always failed with below error - "Error running 'hello': Python helpers are not copied yet to the remote host. Please wait until remote interpreter initialization finishes." To solve this issue, I had to remove the ".pycharm_helpers " folder from the remove device and then restart PyCharm so that the folder is re-created and files are copied again. Here are the steps with comma

Customized Crosshair with OxyPlot charting library

I am using Oxyplot to draw heatmap for a WPF project and needed to draw a crosshair that moves according to user clicks. Since I couldn't find any good example or documentation on the topic, I made a small hack by using LineAnnotations and by over-riding Oxyplot mouse click event. Here is the sample code using WPF with MVVM pattern- MainWindow.xaml <Grid>         <oxy:Plot x:Name="CrossHairPlot">             <oxy:Plot.Axes>                 <oxy:LinearAxis Key="MyXAxis" Position="Bottom" IsZoomEnabled="False"/>                 <oxy:LinearAxis Key="MyYAxis" Position="Left" IsZoomEnabled="False"/>                 <oxy:LinearColorAxis Key="ZAxis" Position="Top" LowColor="Black"                                                                                      HighColor="White" PaletteSize="300">                     <G

Solving ‘Could not resolve host: github.com’ issue

Recently I ran into this issue while trying to clone one of my own repository from GitHub C:\GitHub\FS> git clone https://github.com/<username>/FS.git Cloning into 'FS'... fatal: unable to access 'https://github.com/<username>/FS.git/': Could not resolve host: github.com At first I thought that this could be due to some proxy setting. So I tried to unset it by executing below command - C:\GitHub\FS> git config --global --unset https.proxy But that didn’t fix the problem and I was still getting the same error. As it turned out later, the culprit was my VPN connection. Turning off the VPN fixed the issue. For the records, I was using ‘Surfshark’ on my Windows 10 laptop.