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.
Related
I have the following boilerplate code
from scamp import *
s = Session()
s.tempo = 120
clarinet = s.new_part("clarinet")
When I run it, I get the error
Traceback (most recent call last):
File "/home/norhther/Descargas/music.py", line 6, in <module>
clarinet = s.new_part("clarinet")
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 184, in new_part
instrument.add_soundfont_playback(preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 984, in add_soundfont_playback
SoundfontPlaybackImplementation(bank_and_preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/playback_implementations.py", line 327, in __init__
SoundfontHost(
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/_soundfont_host.py", line 176, in __init__
raise ModuleNotFoundError("FluidSynth not available.")
ModuleNotFoundError: FluidSynth not available.
I installed FluidSynth in my system (Ubuntu) and I can execute it with no problem. I also used pip install pyFluidSynth with pip
Note: This answer predates OP editing the question; The question indeed contained the quoted phrase.
I also used pip install fluidsynth with pip
The fluidsynth package on PyPI was last updated in 2012, and is not what SCAMP depends on for interfacing with FluidSynth. The correct package to be installed is called pyFluidSynth. To install it, run the following command.
pip install pyFluidSynth
You'll also have to uninstall the wrong fluidsynth package.
pip uninstall fluidsynth
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.
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.
I am trying to install the Xgboost library.
The problem is that I am on a virtual machine behind a firewall i don't have access to (company computer). I have the Xgboost library that I downloaded from github.
Then I tried to add the path manually to through the Pycharm project interpreter, therefor i don't have any import error detected, the auto completion is even working but when I try to run the code I have this error :
Traceback (most recent call last):
File "C:/Users/UT2BUP/PycharmProjects/AccountingAdjustment/Run/Execution.py", line 1, in
from Run.Main import Main
File "C:\Users\UT2BUP\PycharmProjects\AccountingAdjustment\Run\Main.py", line 22, in
import Modeling.SkLearnHelper as Sk
File "C:\Users\UT2BUP\PycharmProjects\AccountingAdjustment\Modeling\SkLearnHelper.py", line 35, in
import Modeling.Stacking as Stk
File "C:\Users\UT2BUP\PycharmProjects\AccountingAdjustment\Modeling\Stacking.py", line 6, in
import xgboost as xg
File "C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost__init__.py", line 11, in
from .core import DMatrix, Booster
File "C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost\core.py", line 112, in
_LIB = _load_lib()
File "C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost\core.py", line 103, in _load_lib
lib_path = find_lib_path()
File "C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost\libpath.py", line 46, in find_lib_path
'List of candidates:\n' + ('\n'.join(dll_path)))
xgboost.libpath.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost\libxgboost.dll
C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost../../lib/libxgboost.dll
C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost./lib/libxgboost.dll
C:\ProgramData\Anaconda3\xgboost\libxgboost.dll
C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost../../windows/x64/Release/libxgboost.dll
C:\Users\UT2BUP\Downloads\xgboost-master\python-package\xgboost./windows/x64/Release/libxgboost.dll
So I tried to install with PIP in local but when I do
python pip install C:\Users\UT2BUP\Downloads\xgboost-master\python-package
I got the same error as above (2nd part only).
Any ideas ?
The most straightforward way is to download the xgboost wheel and install using pip.
pip install xgboost‑0.6‑cp36‑cp36m‑win_amd64.whl
The other option is what you are trying to do now. To build from source, you have to make sure your compiler is set up. For instructions on that, I suggest you start on the Windows Compilers page, then visit the docs for compiling xgboost.
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/.