dipc-cc / hubbard

Python tools for mean-field Hubbard models
https://dipc-cc.github.io/hubbard/
GNU Lesser General Public License v3.0
21 stars 8 forks source link

Updating Hubbard #97

Closed mlorenznano closed 3 years ago

mlorenznano commented 3 years ago

Hello, I'm sorry but how do I update to the newest version? I downloaded the 0.1.0 version and installed it. This didn't change anything and when I tried to uninstall the old version with pip uninstall hubbard=0.0.0 I received this error message

ERROR: Cannot uninstall 'hubbard'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

I hope you can help me :)

zerothi commented 3 years ago

To install the development version, do:

pip3 install git+https://github.com/dipc-cc/hubbard.git
mlorenznano commented 3 years ago

I got an error while doing this:

ERROR: Command errored out with exit status 1: command: /home/lorenz/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-n_lcqj62/setup.py'"'"'; file='"'"'/tmp/pip-req-build-n_lcqj62/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-dp117gs6 cwd: /tmp/pip-req-build-n_lcqj62/ Complete output (29 lines): running egg_info running build_src build_src creating /tmp/pip-pip-egg-info-dp117gs6/hubbard.egg-info writing /tmp/pip-pip-egg-info-dp117gs6/hubbard.egg-info/PKG-INFO writing dependency_links to /tmp/pip-pip-egg-info-dp117gs6/hubbard.egg-info/dependency_links.txt Traceback (most recent call last): File "", line 1, in File "/tmp/pip-req-build-n_lcqj62/setup.py", line 125, in setup(name='hubbard', File "/home/lorenz/anaconda3/lib/python3.8/site-packages/numpy/distutils/core.py", line 169, in setup return old_setup(new_attr) File "/home/lorenz/anaconda3/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(attrs) File "/home/lorenz/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/home/lorenz/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/lorenz/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/lorenz/anaconda3/lib/python3.8/site-packages/numpy/distutils/command/egg_info.py", line 25, in run _egg_info.run(self) File "/home/lorenz/anaconda3/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 292, in run writer(self, ep.name, os.path.join(self.egg_info, ep.name)) File "/home/lorenz/anaconda3/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 673, in write_toplevel_names [ File "/home/lorenz/anaconda3/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 674, in k.split('.', 1)[0] AttributeError: 'tuple' object has no attribute 'split'

WARNING: Discarding git+https://github.com/dipc-cc/hubbard.git. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

sofiasanz commented 3 years ago

Yeah I got the same error, let me check...

zerothi commented 3 years ago

Otherwise try and clone hubbard then install manually?

mlorenznano commented 3 years ago

I tried that but I end up with the same version I had before (0.0.0). So I thought I need to uninstall the old version but I have no idea how to do that because I get the error from my first comment.

sofiasanz commented 3 years ago

Hi @mlorenznano I believe that this is related to our setup.py file that is not wrtitting the correct egg_info. I am trying to learn about this (I am not actually very expert in this topic). For the moment I have now added some lines to the __init__.py file that should allow you to print the version of your installation by doing the following:

import hubbard as hubb
print(hubb.__version__)

So please, download the last commit by doing git pull (if you are using git or download the package as a zip folder), install again by doing python setup.py install and run the code lines from above, you should get something like 'v0.1.0+4' (because there are 4 commits above the commit corresponding to the latest release) :)

mlorenznano commented 3 years ago

Hi, sorry for the inconvenience :). I tried both ( git pull and downloading the zip folder) but both times when I run the two lines of code I get the module has no attribute version-error so I think it didn't update.

sofiasanz commented 3 years ago

Have you installed after downloading?

mlorenznano commented 3 years ago

Yes

sofiasanz commented 3 years ago

Ok, thanks! Please can you pass me the output when you run python setup.py install? Sometimes it happens that there are various installation paths and python is using one of them, while you are updating another one.

mlorenznano commented 3 years ago
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_py
creating build
creating build/lib
creating build/lib/hubbard
copying hubbard/__init__.py -> build/lib/hubbard
copying hubbard/hamiltonian.py -> build/lib/hubbard
copying hubbard/ncsile.py -> build/lib/hubbard
copying hubbard/density.py -> build/lib/hubbard
copying hubbard/setup.py -> build/lib/hubbard
copying hubbard/sp2.py -> build/lib/hubbard
copying hubbard/negf.py -> build/lib/hubbard
copying hubbard/info.py -> build/lib/hubbard
creating build/lib/hubbard/plot
copying hubbard/plot/wavefunction.py -> build/lib/hubbard/plot
copying hubbard/plot/bandstructure.py -> build/lib/hubbard/plot
copying hubbard/plot/plot.py -> build/lib/hubbard/plot
copying hubbard/plot/__init__.py -> build/lib/hubbard/plot
copying hubbard/plot/charge.py -> build/lib/hubbard/plot
copying hubbard/plot/spectrum.py -> build/lib/hubbard/plot
copying hubbard/plot/bonds.py -> build/lib/hubbard/plot
running install_lib
copying build/lib/hubbard/__init__.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/hamiltonian.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/plot/wavefunction.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/bandstructure.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/plot.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/__init__.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/charge.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/spectrum.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/plot/bonds.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot
copying build/lib/hubbard/ncsile.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/density.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/setup.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/sp2.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/negf.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
copying build/lib/hubbard/info.py -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/__init__.py to __init__.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/hamiltonian.py to hamiltonian.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/wavefunction.py to wavefunction.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/bandstructure.py to bandstructure.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/plot.py to plot.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/__init__.py to __init__.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/charge.py to charge.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/spectrum.py to spectrum.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/plot/bonds.py to bonds.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/ncsile.py to ncsile.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/density.py to density.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/setup.py to setup.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/sp2.py to sp2.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/negf.py to negf.cpython-38.pyc
byte-compiling /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/info.py to info.cpython-38.pyc
running install_data
copying hubbard/EQCONTOUR -> /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard/
running install_egg_info
Removing /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard-0.0.0-py3.8.egg-info
Writing /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard-0.0.0-py3.8.egg-info
running install_clib
customize UnixCCompiler
C compiler: /home/lorenz/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/lorenz/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/lorenz/anaconda3/include -fPIC

creating /tmp/tmpack_vjog/tmp
creating /tmp/tmpack_vjog/tmp/tmpack_vjog
compile options: '-MMD -MF /tmp/tmpack_vjog/file.c.d -c'
x86_64-conda_cos6-linux-gnu-cc: /tmp/tmpack_vjog/file.c
sofiasanz commented 3 years ago

Thanks, now you can do:

import hubbard
print(hubbard.__path__)

which should give you /home/lorenz/anaconda3/lib/python3.8/site-packages/hubbard. If not, then python is not using the correct path.

mlorenznano commented 3 years ago

Ah yes thank you, the output is /home/lorenz/.local/lib/python3.8/site-packages/hubbard so it's the wrong path. How do I change that? :)

sofiasanz commented 3 years ago

It looks like you're using anaconda, from your comment https://github.com/dipc-cc/hubbard/issues/97#issuecomment-847060638), right? I would use the path from anaconda to have most packages in the same place, and avoid problems like this one (and another possible ones, such as some dependencies problems and so on). So maybe you could start by removing the folder /home/lorenz/.local/lib/python3.8/site-packages/hubbard. And see if python now uses the other path. If not, you can always modify your .bashrc by adding the following line: export PYTHONPATH=<path-to-hubbard-repo>/hubbard:${PYTHONPATH}

mlorenznano commented 3 years ago

It worked. Thank you so much 🚀 . I'm sorry that I'm not better at that stuff

sofiasanz commented 3 years ago

Excellent! Don't worry, it's also nice for me to understand better the depths of python ;)