Can't start Mercurial - mercurial

When I put “hg —version” in my mac terminal, it shows below Error…
Traceback (most recent call last):
File "/usr/local/bin/hg", line 41, in <module>
mercurial.util.setbinary(fp)
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 106, in __getattribute__
self._load()
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 78, in _load
mod = _hgextimport(_import, head, globals, locals, None, level)
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 47, in _hgextimport
return importfunc(name, globals, *args)
File "/Library/Python/2.7/site-packages/mercurial/util.py", line 70, in <module>
statfiles = getattr(osutil, 'statfiles', platform.statfiles)
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 106, in __getattribute__
self._load()
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 78, in _load
mod = _hgextimport(_import, head, globals, locals, None, level)
File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 47, in _hgextimport
return importfunc(name, globals, *args)
ImportError: dlopen(/Library/Python/2.7/site-packages/mercurial/osutil.so, 2): Symbol not found: _fdopendir$INODE64
Referenced from: /Library/Python/2.7/site-packages/mercurial/osutil.so
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Python/2.7/site-packages/mercurial/osutil.so
How I fix this?
Thank you in advance for any help you can provide.
PS : Sorry for my poor English.

Finally I got Answer…!
Step1: Go to “/Library/Python/2.7/site-packages” folder.
>$ cd /Library/Python/2.7/site-packages
Step2: Remove below files in "site-packages" folder.
>$ rm -rf hgext
>$ rm -rf mercurial
>$ rm -rf mercurial-3.7.3-py2.7.egg-info
Step 3: Now install mercurial

Related

Getting Error: did you install mysqlclient? even though mysqlclient is installed on MacOS when trying to access the database in django

I am using MacOS 10.13.1 and python version 3.7.2.
I used pip3 install mysqlclient to install mysqlclient and it was successful:
MacBook-Air:~ user$ pip3 install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f8/9b/5db9a03e2088a87c26e3e4d4c7f7e8f4c2dbae610f9521cdfac15755a795/mysqlclient-1.4.5.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... done
Created wheel for mysqlclient: filename=mysqlclient-1.4.5-cp37-cp37m-macosx_10_9_x86_64.whl size=56101 sha256=3c1ab2eed45ecf064e60ceda15f2d85f4b01367e7c7e6ed887f483732b9d5e8c
Stored in directory: /Users/user/Library/Caches/pip/wheels/26/51/0c/3b9ab7013c539c744cddb55989ef494779fa08e8b273ab5ddf
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.5
pip3 list confirms that version 1.4.5 of mysqlclient has been installed.
However, when running python3 manage.py makemigrations in the directory containing my project, this error comes up:
MacBook-Air:averages user$ python3 manage.py shell
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: #rpath/libmysqlclient.21.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'averages_db',
'USER': 'user',
'PASSWORD': 'password',
}
}
I have looked at other posts with similar problems but I have found nothing of use. Any help would be appreciated.
Check if you are using Python3.7 when executing pip3:
pip3 --version
My output (debian) is:
pip 19.2.3 from /home/username/.local/lib/python3.5/site-packages/pip (python 3.5)
My version of pip3 is using Python3.5.
The solution to install it with python3.7 would be to execute:
python3.7 -m pip install mysqlclient
If that is the case, you might want to use the Python tool virtual environment link.
I had this error myself and for me the problem was that the pip install was placing my files into my /usr/local/mysql/lib folder. When trying to use it with python it is searching for the libraries in /usr/local/lib instead. Just copy pasting the files from my /usr/local/mysql/lib into /usr/local/lib solved the issue for me.
Note Library not loaded: #rpath/libmysqlclient.21.dylib near the start of the error message. I copy pasted that library and then the same error came up but with a different library. Copy pasted again twice more with libssl.1.1.dylib and then libcrypto.1.1.dylib. After putting all three of the mentioned libraries into /usr/local/lib, it worked fine.
You need run this command:
pip install mysqlclient
In your virtual environment. Link

My django can't runserver on mac

Hi all and thanks for taking time to help.
I am a front-end developer and newbie on the Django project.
I am trying to config a project on my Mac.
My colleague helped me to install the virtual environment but it an error still be there when I try to run the server of my project(Hobbit is the name of my project).
(env) ➜ Hobbit git:(feature/sell_system_main) ✗ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/contrib/admin/forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/contrib/auth/models.py", line 48, in <module>
class Permission(models.Model):
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/models/base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/models/options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/liao/workspace/env/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/liao/workspace/env/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient.18.dylib
Referenced from: /Users/liao/workspace/env/lib/python2.7/site-packages/_mysql.so
Reason: image not found
So I try to reinstall mysql by pip install mysql-python and result is
Requirement already satisfied (use --upgrade to upgrade): mysql-python in /Users/liao/workspace/env/lib/python2.7/site-packages
It seems that I have installed mysql in virtual environment.
Now I am confused what is the problem. Mysql or Django?

ubuntu mysqldb not installed properly

I'm running the following commands and get the following error:
root# sudo python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/usr/lib/pymodules/python2.6/django/core/management/sql.py", line 5, in <module>
from django.contrib.contenttypes import generic
File "/usr/lib/pymodules/python2.6/django/contrib/contenttypes/generic.py", line 6, in <module>
from django.db import connection
File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 77, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 32, in load_backend
return import_module('.base', backend_name)
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/lib/pymodules/python2.6/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
I have a feeling that mysqldb isn't configured properly with django, I was wondering if i'm missing anything. i ran the following commands right before it:
# apt-get install python-django
# apt-get install python-mysqldb
I had this same issue where my virtualenv was broken and could no longer run django when I upgraded to ubuntu 12.04.
I simply ran (while my ve was active)
pip uninstall MySQL-python
and then re-installed it with
pip install MySQL-python
worked fine again after that.

Mercurial (hg) update error, abort: No such file or directory

I am unable to update mercurial repos on my machine. I get the following error when I do an update hg up --traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 87, in _runcatch
return _dispatch(req)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 679, in _dispatch
cmdpats, cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 454, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 733, in _runcommand
return checkargs()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 687, in checkargs
return cmdfunc()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 676, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 385, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 5131, in update
ret = hg.update(repo, rev)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 395, in update
stats = mergemod.update(repo, node, False, False, None)
File "/usr/lib/python2.7/dist-packages/mercurial/merge.py", line 554, in update
stats = applyupdates(repo, action, wc, p2, pa, overwrite)
File "/usr/lib/python2.7/dist-packages/mercurial/merge.py", line 329, in applyupdates
subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
File "/usr/lib/python2.7/dist-packages/mercurial/subrepo.py", line 156, in submerge
mctx.sub(s).get(r)
File "/usr/lib/python2.7/dist-packages/mercurial/subrepo.py", line 668, in get
if self._svnversion >= (1, 5):
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 169, in __get__
result = self.func(obj)
File "/usr/lib/python2.7/dist-packages/mercurial/subrepo.py", line 567, in _svnversion
output, err = self._svncommand(['--version'], filename=None)
File "/usr/lib/python2.7/dist-packages/mercurial/subrepo.py", line 555, in _svncommand
universal_newlines=True, env=env, **extrakw)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1239, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
abort: No such file or directory
I've tried to do rm -rf myrepo and then do hg clone ssh://hg#bitbucket.org/myrepo but that command downloads the repo correctly but I get the same error when hg tries to update the repo to branch default, more specifically I get this:
destination directory: foo
requesting all changes
adding changesets
adding manifests
adding file changes
added 6270 changesets with 20990 changes to 3682 files
updating to branch default
abort: No such file or directory
with trackback, I get an error similar to what I was getting before. I have even tried to re-install mercurial on my system without any luck.
Can you please point to what is the problem. The repo head seems to be alright, (I can clone and update on other machines), and I am able to clone or update other hg repos on my system. Can this have anything to do with subrepos? The trackback suggests it.
My system details: 32-bit Ubuntu 11.10, running mercurial version 1.9.1.
It seems that the source repo has an svn subrepo, and you have no subversion client installed (or svn is not in the search path).

Question regarding Mercurial 1.8.2

i have a big problem with Mercurial 1.8.2 on Mac OSX 10.6
I used for long time with a lot of projects. Now i haven't used for about 4 weeks. Today i tried and OSX crashed with "hg add" command.
So i googled a little bit and found out, that there was a bug in OSX 10.5 where i have to deactive the SET LOCAL in Terminal Preferences.
I've done so - now
hg add
hg commit -m "message"
works, but when i run
hg push
i get the following error message where i find no information about
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)]
** Mercurial Distributed SCM (version 1.8.2+20110401)
** Extensions loaded:
Traceback (most recent call last):
File "/usr/local/bin/hg", line 38, in <module>
mercurial.dispatch.run()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 16, in run
sys.exit(dispatch(sys.argv[1:]))
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 36, in dispatch
return _runcatch(u, args)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 58, in _runcatch
return _dispatch(ui, args)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 601, in _dispatch
cmdpats, cmdoptions)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 406, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 655, in _runcommand
return checkargs()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 609, in checkargs
return cmdfunc()
File "/Library/Python/2.6/site-packages/mercurial/dispatch.py", line 598, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/Library/Python/2.6/site-packages/mercurial/util.py", line 433, in check
return func(*args, **kwargs)
File "/Library/Python/2.6/site-packages/mercurial/commands.py", line 3002, in push
ui.status(_('pushing to %s\n') % url.hidepassword(dest))
File "/Library/Python/2.6/site-packages/mercurial/demandimport.py", line 75, in __getattribute__
self._load()
File "/Library/Python/2.6/site-packages/mercurial/demandimport.py", line 47, in _load
mod = _origimport(head, globals, locals)
File "/Library/Python/2.6/site-packages/mercurial/url.py", line 354, in <module>
class httpconnection(keepalive.HTTPConnection):
File "/Library/Python/2.6/site-packages/mercurial/demandimport.py", line 75, in __getattribute__
self._load()
File "/Library/Python/2.6/site-packages/mercurial/demandimport.py", line 47, in _load
mod = _origimport(head, globals, locals)
File "/Library/Python/2.6/site-packages/mercurial/keepalive.py", line 361, in <module>
class HTTPResponse(httplib.HTTPResponse):
File "/Library/Python/2.6/site-packages/mercurial/demandimport.py", line 76, in __getattribute__
return getattr(self._module, attr)
AttributeError: 'module' object has no attribute 'HTTPResponse'
Do you have any ideas?
Thanks,
Sascha
I think you should do exactly as said in the error message :
** unknown exception encountered, please report by visiting
** https://www.mercurial-scm.org/wiki/BugTracker