Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'sas' #467

Closed
Synthos opened this issue Aug 3, 2021 · 8 comments
Closed

ModuleNotFoundError: No module named 'sas' #467

Synthos opened this issue Aug 3, 2021 · 8 comments

Comments

@Synthos
Copy link

Synthos commented Aug 3, 2021

Hi everyone

I am trying to use the sasmodels library as a stand alone package in PyCharm.

So far, I tried different approaches, like simply installing sasmodels over the IDE. However, when I try to e.g. load some data with:

from sasmodels import data foo = data.load_data('file_name')

I receive the following error: ModuleNotFoundError: No module named 'sas'

I then deleted the project again and followed the description on https://pypi.org/project/sasmodels/
For that, I created a new folder and installed all the conda dependencies as described in the above tutorial. I can run the files such as sasmodels.jitter from the console. But as soon as I open the project in PyCharm it does not work anymore.

I did not find the module 'sas' and installing the sasview model also did not help. Did I understand something fundamentally wrong with regards to what is meant with "stand alone package"?

Did someone experience similar issues? My workstation has the following specs:

MB Pro 13-inch 2020
macOS Big Sur Version 11.4

I appreciate your help. Thanks in advance! :)

@KLDwaSiedem
Copy link

KLDwaSiedem commented Aug 7, 2021

Check out the section titled "Fitting Example" in the sasmodels README. [PAK: updated link]

To load the example data, you will need the SAS data loader from the sasview package. This is not yet available on PyPI, so you will need a copy of the SasView source code to run it. Create a directory somewhere to hold the sasview and sasmodels source code, which we will refer to as $SOURCE.

So you need to also download the sasview repo, and add sasview/src to PYTHONPATH. They describe how to do this in the link above. Alternatively you can use sys.path.append('~/sasview/src')

Good luck.

@butlerpd
Copy link
Member

Thanks @KLDwaSiedem -- I trust this solves your problem @Synthos? If so we can close this ticket.

@pkienzle
Copy link
Contributor

pkienzle commented Nov 9, 2021

This process can be simplified by putting sasmodels on pypi (see #273)

@butlerpd
Copy link
Member

butlerpd commented Dec 4, 2021

This process can be simplified by putting sasmodels on pypi (see #273)

I assume you mean sascalc? or perhaps sasdata? pypi is where sasmodels was retrieved from in the first place?

@lucas-wilkins
Copy link
Contributor

I use PyCharm. I have it set up so that src and src/sas are marked as "source directories". If you have the add source directories to python path box checked in the run configuration (spanner icon, or project properties), it should be able to find things.

@pkienzle
Copy link
Contributor

Why do you need src/sas on the path?

It seems like it would cause confusion since it would allow, for example, importing of both sascalc and sas.sascalc.

@lucas-wilkins
Copy link
Contributor

I do it mostly so the pycharm dev tools can pick up locations of files correctly, and the default run configuration works. Might be more than is necessary, but seems fine.

@pkienzle
Copy link
Contributor

I tweaked the error message so that we can close this ticket. We will need to tweak it again once nxsunit and the data loaders are available as a separate package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants