GenericMappingTools / pygmt

A Python interface for the Generic Mapping Tools.
https://www.pygmt.org
BSD 3-Clause "New" or "Revised" License
759 stars 220 forks source link

the problem of import the pygmt module #1389

Closed 15964265917xhw closed 3 years ago

15964265917xhw commented 3 years ago

Description of the problem

when i import the pygmt module in python, the shell report that it have decoding error. Full code that generated the error

import pygmt

Full error message

  File "<stdin>", line 1, in <module>
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\__init__.py", line 57, in <module>
    _begin()
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\session_management.py", line 16, in begin
    with Session() as lib:
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\clib\session.py", line 185, in __enter__
    self.create("pygmt-session")
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\clib\session.py", line 332, in create
    c_create_session = self.get_libgmt_func(
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\clib\session.py", line 284, in get_libgmt_func
    self._libgmt = load_libgmt()
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\clib\loading.py", line 47, in load_libgmt
    for libname in lib_fullnames:
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pygmt\clib\loading.py", line 122, in clib_full_names
    sp.check_output(["gmt", "--show-library"], encoding="utf-8").rstrip("\n")
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 507, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1121, in communicate
    stdout = self.stdout.read()
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 6: invalid start byte

System information Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32 Please paste the output of python -c "import pygmt; pygmt.show_versions()":


PASTE THE OUTPUT HERE
``` File "<stdin>", line 1
    python -c "import pygmt; pygmt.show_versions()"
welcome[bot] commented 3 years ago

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

weiji14 commented 3 years ago

Hi @15964265917xhw. It's a little hard for us to tell what exactly went wrong with your installation. Could you describe a bit more on how you installed PyGMT? My guess is that your pygmt installation is broken and you might need to try again following https://www.pygmt.org/v0.4.0/install.html.

seisman commented 3 years ago

Ping @15964265917xhw to provide more information.

Could you also please post the output of gmt --show-library if you can run the GMT command in CMD.

seisman commented 3 years ago

I'm closing the issue because we don't hear feedback from the issue author and we can't reproduce the issue.

@15964265917xhw Feel free to reopen the issue if you still have the same problem.