user123892
user123892

Reputation: 1289

Broken virtualenv after brew update

I did an update/upgrade of homebrew.

After that, in all my django-projects virtualenvs, Python got broken.

What I did:

  1. Reinstallation of virtualenv package:

    $ pip uninstall virtualenv && pip install virtualenv
    $ virtualenv --no-site-packages .virtualenv
    $ source .virtualenv/bin/activate
    
  2. Rebuild virtualenv

    $cd .virtualenv/
    $ find . -type l -delete
    $ virtualenv .
    

    OK, Python back in business

  3. Launch local server

    $python manage.py runserver
    
    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
    Referenced from: /Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/_mysql.so
    Reason: image not found.
    Did you install mysqlclient or MySQL-python?
    
  4. mysql issue

    $pip uninstall MySQL-python
    $pip install mysqlclient
    
  5. Launch server again

    $python manage.py runserver
    
      [...]
      File "/Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/easy_thumbnails/engine.py", line 12, in <module>
      from easy_thumbnails import utils
      File "/Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/easy_thumbnails/utils.py", line 15, in <module>
      from easy_thumbnails.conf import settings
      File "/Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/easy_thumbnails/conf.py", line 334, in <module>
      settings = Settings()
      File "/Users/marta/work/webDev/scaleway_servermg/vetrinamg/.virtualenv/lib/python2.7/site-packages/easy_thumbnails/conf.py", line 21, in __init__
      super(AppSettings, self).__init__(*args, **kwargs)
      TypeError: __init__() takes exactly 2 arguments (1 given)
    

Could anyone point me to the correct solution?

I have the sensation that, as soon I fix a problem, a new one shows up.

Thank you for any help you could provide

Upvotes: 2

Views: 1478

Answers (1)

user123892
user123892

Reputation: 1289

before becoming crazy, I decided to delete and recreate my virtualenv:

 virtualenv --no-site-packages .virtualenv
 source .virtualenv/bin/activate

install the project requirements:

pip install -r vetrinamg/requirements/local.txt

install mysqlclient:

pip install mysqlclient

recreate my local db:

mysql -u root
mysql> CREATE DATABASE db_vetrinamg;
mysql> USE db_vetrinamg;

migrate my models:

python manage.py migrate
python manage.py makemigrations
python manage.py migrate

boom, everything is running smoothly!

Upvotes: 3

Related Questions