I am trying to install poetry using the following command
curl -sSL https://install.python-poetry.org | python3 -
but it is failing with the following exception:
Exception: This build of python cannot create venvs without using symlinks
Below is the text detailing the error
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/Users/DaftaryG/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.2.1): Creating environment
Traceback (most recent call last):
File "<stdin>", line 940, in <module>
File "<stdin>", line 919, in main
File "<stdin>", line 550, in run
File "<stdin>", line 571, in install
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
return next(self.gen)
File "<stdin>", line 643, in make_env
File "<stdin>", line 629, in make_env
File "<stdin>", line 309, in make
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 66, in __init__
self.symlinks = should_use_symlinks(symlinks)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 31, in should_use_symlinks
raise Exception("This build of python cannot create venvs without using symlinks")
Exception: This build of python cannot create venvs without using symlinks
I already have symlinks installed so not having that does not seem to be the problem. Would anyone know the cause of this error?
Not the best solution, but you can install it using Homebrew, if you have it. That's what I did.
brew install poetry
I had the same error.
In my case, the problem was the global version of python set by pyenv was not python 3.x.
So
pyenv global 3.x.x
fixed it.
For anyone looking for an alternative to homebrew for installation, the discussion on this poetry issue helped me find a solution:
The issue here is the macOS-provided python is not relocatable, so venv creates a broken python when using --copies / symlinks=False as our installer does.
Essentially, to solve this problem, download a distribution of python directly from python.org. For whatever reason, the poetry installation command isn't compatible with whatever distribution comes pre-built on a Mac.
Related
I installed the last version of Miniconda and created a new environment.
I have pip installed the following repos:
pip install git+https://git.ufz.de/FINAM/finam.git
pip install git+https://git.ufz.de/FINAM/finam-netcdf.git
pip install git+https://git.ufz.de/FINAM/finam-plot.git
pip install git+https://git.ufz.de/FINAM/finam-graph.git
Finally, I cloned this repo
git clone https://git.ufz.de/FINAM/finam-examples.git
In that repo I ran two files component.py and pet_calculator.py located at:
~/finam-examples/01_Hargreaves-Samani/src/
I first ran component.py, and that was ok.
The problem came when I ran pet_calculator.py.
This is my error:
(test) sh-3.2$ /Users/lealroja/miniconda3/envs/test/bin/python /Users/lealroja/Documents/UFZ/finam_project/finam-examples/01_Hargreaves-Samani/src/pet_calculator.py
2023-02-19 23:09:44,109 INFO: init composition - FINAM
Traceback (most recent call last):
File "/Users/lealroja/Documents/UFZ/finam_project/finam-examples/01_Hargreaves-Samani/src/pet_calculator.py", line 49, in <module>
composition.initialize()
File "/Users/lealroja/miniconda3/envs/test/lib/python3.11/site-packages/finam/schedule.py", line 148, in initialize
mod.initialize()
File "/Users/lealroja/miniconda3/envs/test/lib/python3.11/site-packages/finam/sdk/component.py", line 65, in initialize
self._initialize()
File "/Users/lealroja/miniconda3/envs/test/lib/python3.11/site-packages/finam_netcdf/reader.py", line 191, in _initialize
self.dataset = xr.open_dataset(self.path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lealroja/miniconda3/envs/test/lib/python3.11/site-packages/xarray/backends/api.py", line 510, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lealroja/miniconda3/envs/test/lib/python3.11/site-packages/xarray/backends/plugins.py", line 177, in guess_engine
raise ValueError(error_msg)
ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', 'scipy']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies, see:
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
https://docs.xarray.dev/en/stable/user-guide/io.html
I have that error when using a Mac book Pro. However, when I do the exact same procedure and run it in Ubuntu I have no issues.
I am not an expert, and therefore I have no idea what to do. Could you please help me?
I have tried answers from this links:
IO backend error in the xarray for netcdf file
ValueError: found the following matches with the input file in xarray's IO backends: ['netcdf4', 'h5netcdf']
Thank you in advance.
I bought a MacBook Pro 13 M1 (16 GB RAM, 1 TB SSD) and I'm trying to get it setup for work and part of that is using python 2 (yes I know it's end of life, I still need to use it till we finish porting to go). I have some python packages I'd like to remove from my system python2 (I'm sure I must've run sudo pip install on these at some point, which I know was stupid, but what is done is done) and now that I'm on Big Sur I can't remove these packages. I tried disabling SIP until I can get them removed (csrutil disable from recovery), but now I'm getting errors that I can't remove files from a read only filesystem
sudo pip uninstall cryptography 2 14:34
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: The directory '/Users/darren/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Found existing installation: cryptography 3.3.2
Uninstalling cryptography-3.3.2:
Would remove:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography-3.3.2-py2.7.egg-info
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/commands/uninstall.py", line 90, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_install.py", line 686, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_uninstall.py", line 403, in remove
moved.stash(path)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_uninstall.py", line 292, in stash
renames(path, new_path)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/utils/misc.py", line 355, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 323, in move
rmtree(src)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 270, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 273, in rmtree
os.remove(fullname)
OSError: [Errno 30] Read-only file system: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/_der.py'
but I can't remount root as read/write and get this error when I try:
sudo mount -uw /
mount_apfs: volume could not be mounted: Permission denied
mount: / failed with 66
How do I remove these files from /System/Library if it's read only? Do I have to format my system and start from scratch now that mac os put these files in a read only filesystem or is there a way to remove them?
Edit:
So I have broken packages in /System/Library that are preventing fabric from running so I can't get our stuff up and running. The main one being the cryptography package. So I either need to fix these packages so fabric can run or remove them or something.
The other part that makes this such a pain is that I'm trying to run python 2 on an M1 Mac which means either using the built in python or using rosetta with an x86 python2 as I have found no method for installing arm python 2 on an M1 Mac (there isn't an installer from python.org or brew since python2 was end of life when the M1 Macs shipped).
Edit2:
Maybe these packages that I'm having issues with did ship with Mac OS as the package's folder's created timestamp is "Jan 1 01:00:00 2020" just like every other file & folder in that same folder. If so I guess I need to fix them somehow. When I try to run fab from the command line I get this error in the cryptography package:
fab
/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.hazmat.backends import default_backend
Traceback (most recent call last):
File "/Users/darren/Library/Python/2.7/bin/fab", line 5, in <module>
from fabric.main import program
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/fabric/__init__.py", line 3, in <module>
from .connection import Config, Connection
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/fabric/connection.py", line 16, in <module>
from paramiko.agent import AgentRequestHandler
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 129, in <module>
class Transport(threading.Thread, ClosingContextManager):
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 190, in Transport
if KexCurve25519.is_available():
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/kex_curve25519.py", line 30, in is_available
X25519PrivateKey.generate()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/primitives/asymmetric/x25519.py", line 39, in generate
from cryptography.hazmat.backends.openssl.backend import backend
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/backends/openssl/backend.py", line 117, in <module>
from cryptography.hazmat.bindings.openssl import binding
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _DTLS_client_method
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/_openssl.so
Expected in: flat namespace
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 120, in _join_lingering_threads
for thr in _active_threads:
TypeError: 'NoneType' object is not iterable
Error in sys.exitfunc:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 120, in _join_lingering_threads
for thr in _active_threads:
TypeError: 'NoneType' object is not iterable
Has anyone else had this problem or have a fix for it?
I was able to install python2 for Apple Silicon/M1 from nix and then I had to manually install pip which let me install cryptography & cffi (I had libffi installed from brew). Here are the steps I used, I'm not sure if they're all necessary, but it's what I did:
Install Nix
see https://nixos.org/manual/nix/stable/#sect-macos-installation for more details, but if you have a mac with a T2 chip or M1 this will still be encrypted
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
Install python2 from nix
nix-env -i python-2.7.18
verify that you're using this python in a new terminal session (you'll need to start a new shell to get the updated path)
run which python
if it doesn't return something like /Users/user/.nix-profile/bin/python you'll want to add ~/.nix-profile/bin to the front of your path, start a new shell, and run which python again
Install pip
See https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py for more details, but if you curl the get-pip.py in this url and run it with python 2 it'll tell you to instead download and use the get-pip.py from https://bootstrap.pypa.io/pip/2.7/get-pip.py
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python ./get-pip.py
Use brew to install libiff and openssl#1.1
I had done this step previously and I'm not 100% sure it's necessary, but I believe it is
brew install libiff openssl#1.1
Add the following to your .bashrc, .zshrc, .profile, or wherever you set your environment variables:
export LDFLAGS="-L$(brew --prefix openssl#1.1)/lib"
export CFLAGS="-I$(brew --prefix openssl#1.1)/include"
use pip to install cryptography
pip install cryptography
After this I had a functional python with cryptography installed and I was then able to install fabric (via pip install fabric==1.14.1 since 1.14.1 is the version I need for this old project, use what you need)
Edit:
Thanks to #CharlesDuffy for all of his help and as he correctly mentions in the comments bellow, you could (and probably should) install all of the dependencies and cryptography from nix instead of using a combination of brew and nix. I had brew and the dependancies installed before I had Nix installed so I haven't tested it out, but it should work.
What do I do wrong?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1- py3.4.egg/pkg_resources/__init__.py", line 558, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2682, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2355, in load
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2361, in resolve
ImportError: No module named 'pip'
Stackoverflow asked me to type more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more
Try to fix pip installation with:
sudo apt-get install python3-pip
I've had the same issue and this worked for me. Maybe it's because you only installed pip for an earlier version of python or you intalled it from source and not from you distributions package management.
It sounds like your pip variable isn't set or you're trying to use conflicting environments. If you want to get the python package pymongo installed on your 3.4 version look to use:
/usr/local/bin/pip3.4 install pymongo
Then you can verify by testing in the 3.4 interpreter by running:
python3.4
>>>import pymongo
>>>
In the future look at using virtualenvs, they can be really easy and clean to work with while controlling your packages neatly. Hope this helps!
I am trying to build the HelloWorld example page from the Pyjamas example folder. However I am receiving this error when I run: sudo pyjsbuild helloworld.py. This error seems pretty universal to python as it seems to be related to the setup/configuration of my python environment. Any advice on where to look for the problem?
Here is the error
Traceback (most recent call last):
File "/usr/local/bin/pyjsbuild", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: six
After trying the various answers, it turns out pip was not properly installing the six package, whatever that is. So I ran sudo easy_install pip (--upgrade) to make sure the script configuration was right. It wrote some extra files so I assume that's why my next command sudo pip install six or sudo pip install six --upgrade worked. Now I ran into another error -_-, For anyone looking later: Runtime Error: Top module not found 'hello world'
Edit: The top module error is coming from trying to build into the output folder that is not pyjs/. All I had to do was move the folder up to pyjs/ folder in sitepackages/.
I have installed python under /opt/python2.7.1/ on CentOS machine which has already python2.4 and configure it to run python2.7 default.
However, when I write 'easy_install' it raises error like
Traceback (most recent call last):
File "/opt/python2.7.1/bin/easy_install", line 5, in ?
from pkg_resources import load_entry_point
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2482, in ?
for dist in working_set.resolve(
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==0.6c11
I think easy_install under /usr/bin/ links to python2.4. How can I run /opt/python2.7.1/bin/easy_install default?
For $PATH:
/opt/python2.7.1/bin:/usr/devs/bin:/usr/local/bin:/bin:/usr/bin:/home/ops/bin
For $LD_LIBRARY_PATH:
/opt/python2.7.1/lib:
For easy_install:
Traceback (most recent call last):
File "/opt/python2.7.1/bin/easy_install", line 5, in ?
from pkg_resources import load_entry_point
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2482, in ?
for dist in working_set.resolve(
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==0.6c11
You have to make use of virtualenv to get things working properly, and without worries in systems with more than one Python version.
Actually, it is quite a help even in system qwith a single Python version, if you have muliple Python apps running.
Visrtualenv will not only take care of setting up all the appropriate environment variables for you to use one Python or another, as it will allow you to use use a separate environment where you can safely "easy_install" Python 2.4 modules without conflicting with CentOS .rpm packages of those same modules.