Could not call install_name_tool - python

Trying to use virutalenv version 1.6.4 (the latest at writing this post) on 10.7, Lion with yes Xcode 4 installed from mac app store, yet i'm getting the below error message:
New python executable in SUPENV/bin/python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python #executable_path/../.Python SUPENV/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 810, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 901, in create_environment
site_packages=site_packages, clear=clear))
File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 1166, in install_python
py_executable])
File "/Library/Python/2.7/site-packages/virtualenv-1.6.4-py2.7.egg/virtualenv.py", line 843, in call_subprocess
cwd=cwd, env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
Any hints on how to solve this problem... I guess the first would be to check if install_name_tool is present on my system, and then force virtualenv to use it...
thanks in advance!

You need to both install XCode, run it, and select the optional "command line tools" package and then install those. In more detail:
Download XCode from the App Store
Run the downloaded XCode binary from Applications or Launchpad
Select XCode->Preferences, then choose the "Downloads" tab
Click on the "Command Line Tools" selection and install those

Did you actually install Xcode 4? Downloading it from the App Store only downloads the installer for it. Then you need to run the installer; you should find the installer downloaded to /Applications. After you run it, you should find install_name_tool here:
$ which install_name_tool
/usr/bin/install_name_tool

With newer versions of virtualenv (at least from 1.8.4 on) it is no longer necessary to install the "Command Line Tools" package from Xcode.

Related

Virtualenv myenv doesn't create virtual environment on exFAT hard drive on Ubuntu 18.04

I am learning Django with python 3.6. I use Ubuntu 18.04.2 LTS which is also new for me. My pip version is 9.0.1. My problem is when I try to create virtual environment on my external exFAT had drive with virtualenv myenv command it gives the error that I shared bellow. But I can create virtual environment on the Desktop with the same command. The problem is very weird for me. I can't solve the problem. Can you guys please help me? Thanks in advance!
SAMPLE CODE: ERROR
c#p:/media/c/2NDTB/testpro$ virtualenv myenv
Using base prefix '/usr'
Traceback (most recent call last):
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 417, in copyfile
os.symlink(os.path.realpath(src), dest)
OSError: [Errno 38] Function not implemented: '/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/c/.local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 831, in main
symlink=options.symlink,
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1106, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1390, in install_python
copy_required_files(stdlib_dir, lib_dir, symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1300, in copy_required_files
copyfile(join(src_dir, fn), join(lib_dir, fn), symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 420, in copyfile
copy_file_or_folder(src, dest, symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 398, in copy_file_or_folder
shutil.copytree(src, dest, symlink)
File "/usr/lib/python3.6/shutil.py", line 359, in copytree
raise Error(errors)
shutil.Error: [('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', "[Errno 38] Function not implemented: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so'"), ('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', "[Errno 38] Function not implemented: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so'")]
I see two problems in what you are trying to do. The first, smaller problem is that FAT doesn't implement symlinks and virtualenvs by default use symlinks to that version of python they have been created with. You can try virtualenv --always-copy to avoid symlinks.
But then you get to the second, bigger problem You're trying to create a virtualenv on a removable drive to port it somewhere. That doesn't work — virtualenvs are not relocatable. When you need a virtualenv at a different place you have to recreate it. To copy the list of installed packages from one virtualenv to another run this in the original virtualenv:
pip freeze >requirements.txt
then move file requirements.txt to the other place, create a new virtualenv and restore packages:
virtualenv venv2
source venv2/bin/activate
pip install -r requirements.txt

Unable to get Jython working on Mac

Installed Jython from the installer.
Set the Path as follows /Users/user/jython2.7.0/bin.
When tried to run Jython, received the following error.
MacBook-Pro:~ user$ jython
Traceback (most recent call last):
File "/Users/user/jython2.7.0/bin/jython", line 444, in <module>
main(sys.argv)
File "/Users/user/jython2.7.0/bin/jython", line 431, in main
os.execvp(command[0], command[1:])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 370, in _execvpe
func(file, *argrest)
OSError: [Errno 2] No such file or directory
Tried uninstalling other packages installed through Homebrew. But nothing positive.
Jython runs with the command java -jar jython.jar from the installation directory.
Tried running on a clean Macbook, everything runs fine.
Resolved the problem by pointing JAVA_HOME to jdk1.8.0_131 rather than jdk9.0.4. Not sure why this solution works.

How to fix ".dist-info directory not found" in my package?

I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nobody left on the team is able to help out.
After running 2to3 on the files of the package, I ran python setup.py sdist to create a package, placed the package in a local repository, then attempted to use pip install to install the package. It ended up erroring out with the following:
Exception:
Traceback (most recent call last):
File "/home/user/project/lib/python3.5/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/home/user/project/lib/python3.5/site-packages/pip/commands/install.py", line 297, in run
root=options.root_path,
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_set.py", line 622, in install
**kwargs
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 808, in install
self.move_wheel_files(self.source_dir, root=root)
File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 1003, in move_wheel_files
isolated=self.isolated,
File "/home/user/project/lib/python3.5/site-packages/pip/wheel.py", line 340, in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: my-package-name .dist-info directory not found
The old Python 2 version of the package didn't have anything called .dist-info in the .tgz archive, and it installed just fine. Does anyone know what's going on here and how to fix it?
In my case this was resolved by deleting AppData\Local\pip\Cache folder (windows). Should be fairly similar for other operating systems.

CKAN Install: paster error

Installing CKAN locally on OSX 10.9, based on http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html.
I've created and activated the python virtualenv and now need to create a CKAN config file:
$ paster make-config ckan /etc/ckan/default/development.ini
The output is as follows (ImportError at the last line):
Distribution already installed:
ckan 2.2 from ~/ckan/lib/default/src/ckan
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 295, in command
self.distro, self.options.ep_group, self.options.ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 234, in get_installer
'paste.app_install', ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
return ep.load()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "~/ckan/lib/default/src/ckan/ckan/config/install.py", line 3, in <module>
from pylons.util import PylonsInstaller
ImportError: No module named pylons.util
I'm not sure how to proceed, any ideas?
ImportError: No module named pylons.util looks like Python cannot find the Pylons package, one of the Python packages that CKAN depends on. Two possibilities come to mind:
Did you activate your CKAN virtualenv, before running the paster command? ~/ckan/default/bin/activate.
Have you installed the Python packages that CKAN depends on into your virtualenv? With the virtualenv activated run pip install -r ~/ckan/default/src/ckan/requirements.txt
If you activate your CKAN virtual environment and then run pip freeze | grep pylons, this should tell you whether pylons is installed in the virtualenv.
The Distribution already installed: at the top of your terminal output is strange.
I had the same error and a slightly different solution:
got the error only after using sudo, so I went out of it (sudo -k)
then I got the following error: IOError: [Errno 13] Permission denied: '/etc/ckan/default/development.ini'
after digging around a lot, I finally found out that while the /etc/ckan had correct permissions, it was actually a symlink to ~/ckan/etc and that folder did not have correct permissions
I ran sudo chown -R `whoami` ~/ckan/etc and followed up with paster make-config ckan /etc/ckan/default/development.ini

Installing Fabric On Windows (Error No Module Called Readline)

I'm trying to use the Fabric 0.1.1 deploy tool (http://docs.fabfile.org/) on Windows and we're running into an issue with the readline module. I've been through various threads but can't seem to solve the issue. It's important because we can't deploy applications from Windows based machines.
C:\Documents and Settings\dev\Desktop\deploy>fab
Traceback (most recent call last):
File "C:\python\Scripts\fab-script.py", line 8, in <module>
load_entry_point('fabric==0.1.1', 'console_scripts', 'fab')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 277, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 2180, in load_entry_point
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 1913, in load
File "build\bdist.win32\egg\fabric.py", line 25, in <module>
**ImportError: No module named readline**
Installing the module results in:
**easy_install readline**
Searching for readline
Reading http://pypi.python.org/simple/readline/
Reading http://www.python.org/
Best match: readline 2.6.4
Downloading http://pypi.python.org/packages/source/r/readline/readline-2.6.4.tar
.gz#md5=7568e8b78f383443ba57c9afec6f4285
Processing readline-2.6.4.tar.gz
Running readline-2.6.4\setup.py -q bdist_egg --dist-dir c:\docume~1\ji81b9~1.che
\locals~1\temp\easy_install-pzkz1a\readline-2.6.4\egg-dist-tmp-szs2ps
Traceback (most recent call last):
File "C:\python\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1671, in main
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1659, in with_ei_usage
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1675, in <lambda>
File "c:\python\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "c:\python\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "c:\python\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 211, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 446, in easy_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 476, in install_item
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 655, in install_eggs
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 930, in build_and_install
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 919, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 27, in run_setup
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 63, in run
File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 29, in <lambda>
File "setup.py", line 93, in <module>
AttributeError: 'module' object has no attribute 'symlink'
Has anybody solved this issue or can anybody suggest a workaround?
The readline module you are trying to install with easy_install is for OS X, not windows. There are Windows-compatible replacements for readline out there but perhaps you should first try updating fabric itself to a more current version (0.9 is out there now).
Grepping the source of the 0.9 version does not find any dependencies on readline.
Following these steps exactly worked for me:
1) Installed using the MSI installer for x86 from here.
2) Installed in the default C:\Python27 directory.
3) Create a new directory: C:\Python27\Scripts
4) Added C:\Python27 and C:\Python27\Scripts to the system path:
5) Download the distribute_setup.py from here into C:\Python27\Scripts
6) Open a command line, navigate to C:\Python27\Scripts, run: 'python distribute_setup.py'
7) now run 'easy_install pip'
8) now run 'pip install fabric'
9) You should get an error saying PyCrypto couldn't install. You can download the pre-build Windows binary from here. Run this to install PyCrypto.
10) run 'pip install fabric' again and it should say everything is installed.
11) in a different directory (let's say c:\dev\hello) create a fabfile.py and add the following code:
def hello(name="world"):
print("Hello %s!" % name)
12) cd to this directory and run 'fab hello:working'. You should see output say
Hello working!
Done.
Give this readline a try. It is a module for Windows that allows additional features in IPython that aren't native and might work with what you are trying to do.
0.1.1 is an older version, I believe. I have no problem installing Fabric on Windows with ActivePython (w/ PyPM):
C:\> pypm install fabric
Ready to perform these actions:
The following packages will be installed:
fabric-0.9.0 pycrypto-2.0.1
Get: [pypm.activestate.com] fabric 0.9.0-1
Get: [pypm.activestate.com] pycrypto 2.0.1-1
Installing fabric-0.9.0
Fixing script C:\Users\sridharr\AppData\Roaming\Python\Scripts\fab-script.py
Installing pycrypto-2.0.1
Download and run easy_install installer for your python version from http://pypi.python.org/pypi/setuptools#downloads . ie: setuptools-0.6c11.win32-py2.6.exe
On the command prompt, lauch easy_install -U fabric to install the last fabric release.
Readline should be available with Cygwin, if you want to move your entire stack in that direction.

Categories

Resources