Posts

Got "/opt/stack/requirements/.venv/bin/pip’: No such file or directory" error installing devstack

Strangely tonight when trying to install devstack for a new experiment, after a couple failing attempts (mostly with directory permissions), I got this message saying:

"/opt/stack/requirements/.venv/bin/pip’: No such file or directory"

What happens?

Turns out it is just virtualenv was failed to install pip in the previous try. Fortunately, I found an easy fix:

$ virtualenv /opt/stack/requirements/.venv/

Then I just need to execute stack.sh again.

Awesome!

Vancouver trip photos

Network interface does not show up with ifconfig and Internet does not work

If for some reasons your ethernet network interface does not show up with ifconfig command, you can do the following to find it and raise it up again:

1. Find the interface:

ifconfig -a

..
enp0s31f6 ... DOWN
...

2. Up the missing interface:

sudo ifconfig enp0s31f6 up

3. Call the DHCP client on the missing interface:

sudo dhclient enp0s31f6


After that, you will be able to access the Internet again.

Django DB migration when you're using a custom MySQL installation dir

For some reason, you installed MySQL in a different path than the default /etc/mysql/. Then if you run the Django's migrate command, it will fail because It cannot communicate with the MySQL process:

django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

If that's the case, you can use the following option in your Django's configuration to indicate the socket directory of MySQL:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
        },
    }
}


That's it. Profit!!!

Virtualenv's env activated but still running system's python

I created a Virtualenv env and activated it but it still running the system's python

(myenv) dangtrinhnt@genius:~$ which python
/usr/bin/python

So I did the following to fix that:

1. Delete the broken Virtualenv env:

sudo rm -rf /my/venv

2. Create a new one with "distribute" parameter:

virtualenv myenv --distribute

3. It works now

(myenv) dangtrinhnt@genius:~$ which python
/myenv/bin/python