How to Install Virtualenv in Ubantu 16.04 or Windows?

Ubantu or Linux

When we are going to run any project in Python Django in the Windows or Ubantu system, we need the virtual environment installed into our system. So first we will see how to install virtual environment into our system.

How to install virtual
virtualenv or environment:

For Ubantu or Linux System:

sudo apt-get install python3-pip

In Windows System, we can use this commands..

apt-get install python3-pip

OR

apt-get install pip

Then install virtualenv using pip3 or pip

For Ubantu System we can use…

sudo pip3 install virtualenv 

OR

sudo pip install virtualenv 

For Windows System, we can use..

pip install virtualenv 


Now create a virtual environment

virtualenv venv 

We can also use a Python interpreter of your choice. like Python 3, Python 3.5 etc

For Ubantu , Linux or Windows we can use this command

virtualenv -p /usr/bin/python2.7 venv

Create virtualenv using Python3

virtualenv -p python3 myenv

Active your virtual environment:

For Ubantu or Linux System..

source venv/bin/activate

Activate Virtual Environment Using fish shell.:

source venv/bin/activate.fish

Activate Virtual Environment using Windows..

Here, the path at venv root path or same directory.

venv/Scripts/activate

How to Check the Linux System Configuration?

 [email protected]:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Model name: Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz
Stepping: 9
CPU MHz: 1693.375
CPU max MHz: 3500.0000
CPU min MHz: 1600.0000
BogoMIPS: 6185.52
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb ssbd ibrs ibpb stibp kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts flush_l1d
[email protected]:~#

Elastic Search is showing Status Failed to Restart

Elastic Search is showing Status Failed to Restart:

  The Previously Elastic search is not working? then please follow these steps::
Step-1::
Remove previous versions of ElasticSearch:
sudo apt-get --purge autoremove elasticsearch
Step-2::
Remove the Elastic Search directories:
sudo rm -rf /var/lib/elasticsearch/

sudo rm -rf /etc/elasticsearch
Step-3::
Now, Re Install ElasticSearch 1.6 (as your version required ):
First,
Downloading and Installing Elasticsearch

Elasticsearch can be downloaded directly from elastic.co in zip, tar.gz, deb, or rpm packages. For Ubuntu, it’s best to use the deb (Debian) package which will install everything you need to run Elasticsearch.

At the time of this writing, the latest Elasticsearch version is 1.7.2. Download it in a directory of your choosing with the command:

wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.6.0.deb

Then install it in the usual Ubuntu way with the dpkg command like this:

sudo dpkg -i elasticsearch-1.6.0.deb
 If you want the latest released version of Elasticsearch, go to elastic.co to find the link, and then use wget to download it to your Droplet. Be sure to download the deb package.
Second,
Go to your elastic search downloaded directory and
cd /.../downloads/.....
now, run this command,
sudo dpkg -i elasticsearch-1.6.0.deb
***  AFTER INSTALL OUTPUT::  ***
——————————————–
Selecting previously unselected package elasticsearch.
(Reading database … 215950 files and directories currently installed.)
Preparing to unpack elasticsearch-1.7.2.deb …
Creating elasticsearch group… OK
Creating elasticsearch user… OK
Unpacking elasticsearch (1.7.2) …
Setting up elasticsearch (1.7.2) …
Processing triggers for systemd (229-4ubuntu21.2) …
Processing triggers for ureadahead (0.100.0-19) …
ureadahead will be reprofiled on next reboot
Step-4::
Now, Start the Elastic search service,
sudo service elasticsearch start
Step-5::
Check the Elastic search, is it working,
sudo service elasticsearch status
Step-6::
Now, Check in your local machine Elastic Search is working or not…
For Output in local machine: type:
http://localhost:9200/
# Result::

{

  "status" : 200,

  "name" : "Skin",

  "cluster_name" : "elasticsearch",

  "version" : {

    "number" : "1.7.2",

    "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",

    "build_timestamp" : "2015-09-14T09:49:53Z",

    "build_snapshot" : false,

    "lucene_version" : "4.10.4"

  },

  "tagline" : "You Know, for Search"

}

 

source: